Logging

Logging is a critical part of any embedded development framework. Most devices can't display error or warning messages and don't have a human user monitoring them. Even when a device does have a display and a user watching it, the log messages often don't help the device's primary user. Displaying messages on a screen doesn't support remote troubleshooting; especially when the device is hidden from view inside a piece of equipment or located in remote geographic regions.

Legato creates log messages in LE_INFO() by default Only minimal info is reported, and only for the current app: essentially logs if the app is communicating. You need to modify default settings to enable monitoring for anything else.

There are two built-in features to control logging using the concepsLogs_tool or Logging API. There are also App Crash Logs.

Access Logs

Run logread on the target to view the system log.

Run logread -f to start monitoring the logs and display messages as they are logged.

The installed app's output LE_INFO() log message will appear in the target's system log (syslog).

Logging Tool

The target log tool is the easiest way to set logging controls. You can control what's being logged, filter levels, trace keywords, and processes all through the command-line in a running system.

Run log level INFO "processName/componentName" to set the log level to INFO for the specified component in a process.

Run log trace "keyword" "processName/componentName" to use a keyword trace.

See log for details.

Default syslog

By default, app processes will have their stdout and stderr redirected to the syslog. Each process’s stdout will be logged at INFO severity level; it’s stderr will be logged at “ERR” severity level.

See Standard Out and Standard Error in Syslog for more info.

Logging API

The Logging API provides a toolkit to set error, warning, info, and debugging messages with macros and condition support including default environment variable controls that can be output to different devices and formats.

See Logging API for details.