I’m trying to redirect the mongoose logs (those created using the LOG macro) to a file either on the flash or SD card file systems. Is this doable? I see it can be directed to a different UART or to other sinks, but I didn’t see a way to direct to a file.
file-logger might help.
Ah thanks! I checked it out and have two questions.
I wanted to disable log output to all the UARTs, since I want to use those to send data to another device. Looking at these docs:
https://mongoose-os.com/docs/mongoose-os/userguide/debug.md
I see I can control which UART the data goes to. It does not say so, but if I set it to -1 I can disable the output. Is this the right way to do it or will it cause me a problem?
mos config-set debug.stderr_uart=-1
mos config-set debug.stdout_uart=-1
Also, I wanted to make a separate directory for system log files. Looking here:
https://forum.mongoose-os.com/discussion/4247/how-to-add-directory-to-filesystem
I see I can create virtual directory paths (since the FS is flat) but if I set the target for the log file there I get a core dump:
filesystem:
- fs
- fs/syslog
- fs/log
config_schema:
- ["file_logger.dir", "/syslog"]
Did I set it wrong?
Thanks again.
The filesystem
directive in mos.yml
tells mos where to find the files from your computer when creating the device’s filesystem image. The device’s filesystem is flat, i.e. everything from fs
, fs/syslog
, fs/log
go in the root directory.
If you want to direct the log files to a different directory, yo can create an adittional filesystem.