Max size of file created when using a system() call from code

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.

Have you set the maxFileBytes or maxFileSystemBytes in .adef?

How about not calling “le_appCtrl_Stop(“StoreLogs”);”?

I had forgotten to add maxFileSystemBytes to my adef, adding that fixed the problem.

Stopping the App had no influence, so I’m keeping that in the code for now.

I don’t see problem with adef like this in WP76 FW 16.0.1:


processes:
{
	envVars:
	{
		LE_LOG_LEVEL = DEBUG
	}

	run:
	{
		( hello1 )
	}

	maxCoreDumpFileBytes: 512K
	maxFileBytes: 512K
}
sandboxed: false
version: 1.0.0
maxFileSystemBytes: 512K