When using the following code in an unsandboxed application it will generate a file of max 102400 bytes and then it stops writing bytes to the file.
COMPONENT_INIT
{
// Write in the log that this component has started.
LE_INFO("Component StoreLogsComponent started.");
system("/sbin/logread > /home/root/log_app.txt");
le_appCtrl_Stop("StoreLogs");
}
If i run this code and the same command in the ssh commandline i get the following file sizes:
root@swi-mdm9x28-wp:~# ls
root@swi-mdm9x28-wp:~# app start StoreLogs
root@swi-mdm9x28-wp:~# /sbin/logread > /home/root/log_cmd.txt
root@swi-mdm9x28-wp:~# app status StoreLogs
[stopped] StoreLogs
root@swi-mdm9x28-wp:~# ls -l
-rw------- 1 root root 102400 Jun 12 13:19 log_app.txt
-rw-r--r-- 1 root root 2036529 Jun 12 13:19 log_cmd.txt
root@swi-mdm9x28-wp:~#
I added the appCtrl_Stop to see if it would fall out of the system call and that looks like it is the case. With or without appCtrl_Stop it stops at 102400 bytes.
What am i doing wrong? We are seeing an issue in the field where they won’t connect reliably so we want to add some logging for the cases where the device does not connect correctly that can then be uploaded/read out when the device connects again and this looked like the easiest route to do this.