PmLog provides logging configuration methods to set the log level and log file by each context.
A configuration file is used to create context(s) for your component and configure the context settings as needed. It must be added to the component’s files/conf/pmlog/<filename>.conf and installed in (WEBOS_INSTALL_SYSCONFDIR)/pmlog.d.
The format and content of the configuration file must be as follows:
Note Please note that it is not mandated to configure your context. You can just call PmLogGetContext() to create a new context, whose settings will take the default values.
The Contexts Section
Here you can specify logging context names and what the default level should be for them. Changes to the Contexts section will only be read at boot time. If you change this section, device has to be rebooted or use PmLogCtl app to see real time changes without rebooting.
The <default> context is specially defined, otherwise client context names should follow the regular rules, i.e. use alphanumeric characters only and use a period (“.”) to separate component hierarchies.
One of the standard pmlog levels or none to disable logging.
Enables to turn on process ID tagging.
Enables to turn on thread ID tagging.
Enables to turn on stdout output.
[OPTIONAL - integer] The ring buffer size for a context
[OPTIONAL - integer] The flush level for a ring buffer. This is one of the pmlog levels.
Specifies routing rules for each context. A rule specifies filter and output.
level: One of the standard syslog levels or use an asterisk ("*") to indicate all. When specifying a level, it implicitly matches that level or higher. The level may be prefixed with '!' to match only lower levels.
program: Specify an exact program name or use an asterisk ("*") to indicate all.
Indicates one of the named output targets previously defined. If a single quote (' ') is specified before the output, it indicates that the specified filter should omit matched messages.
The Outputs Section
Each output defines settings for a particular log file.
Path to file.
Maximum size the file can reach before rotation.
The maximum number of rotations before rotating files out the oldest files.
All context logs are routed to /var/log/messages by default. However, if you want to route context logs to a particular file, you should create a configuration file as above format in /etc/pmlog.d/ directory and set the contextLogging parameter to true as shown in line 23 below in /etc/pmlog.d/default.conf. Then, each component logs are written in an individual file separately.
The /etc/pmlog.d/default.conf has the following default format: