RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Table of Contents | ||
---|---|---|
|
...
RDK loggers logger is a general purpose logging mechanism which is used for logging in RDK-B. Internally this uses log4c for formatting and support supporting multiple log levels and for different modules. The log level for each component is read from a configuration file debug.ini (rdkb_debug.ini) during component initializationinitialisation. Logger is implemented as a shared library and components need to link this library in order to enable include logging functionality.
RDK logger is linked to RDKB RDK-B modules to enable component wise logging. When the unit boots-up, each RDKB RDK-B component will be initialized initialised which in turn will initialize initialise logger and start logging into the corresponding log file depending on the log level set for the component.
Note: The RDK data model naming convention prefix was changed in March 2020 to “X_RDK_”. We request you use this new prefix going forward.
draw.io Diagram | ||||
---|---|---|---|---|
|
...
|
|
All components have the separate TR181 parameters to control the LogLevels and LoggerEnable options.
All component components logger parameters TR181 parameters exist in LogAgent.xml file which is handled by CcspLogAgent component. Those parameters are stored in syscfg.db file for persistent storage.
Note: We can enable/disable logging for the all components based on “X_RDKCENTRAL-COM_LoggerEnable” parameter. It is by default set as to “TRUE”.
Below mentioned are the supported LogLevels:
Log Level Index | Log Level |
0 | RDK_LOG_FATAL |
1 | RDK_LOG_ERROR |
2 | RDK_LOG_WARN |
3 | RDK_LOG_NOTICE |
4 | RDK_LOG_INFO |
5 | RDK_LOG_DEBUG |
6 | RDK_LOG_TRACE1 |
7 | RDK_LOG_TRACE2 |
8 | RDK_LOG_TRACE3 |
9 | RDK_LOG_TRACE4 |
10 | RDK_LOG_TRACE5 |
11 | RDK_LOG_TRACE6 |
12 | RDK_LOG_TRACE7 |
13 | RDK_LOG_TRACE8 |
14 | RDK_LOG_TRACE9 |
If LogLevel is set to 3, all logs related to 0 to 3 levels are routed to logger which means RDK_LOG_FATAL, RDK_LOG_ERROR, RDK_LOG_WARN and RDK_LOG_NOTICE prints are routed to logger, other prints not routed to logger.
...
Panel |
---|
Below function is used for logging in RDKLogger, RDK_LOG (rdk_LogLevel level, const char *module, const char *format,...) "level" is log level of the log message (FATAL, ERROR etc} "module" is Module to which this message belongs to (use module name same as mentioned in debug.ini) "format" is a printf style string containing the log message. |
Log4crc File syntax:
The log4crc configuration file uses an XML syntax.
The root element is <log4c> and it can be used to control the configuration file version interface with the attribute "version".
The following 4 elements are supported: <config>, <category>, <appender> and <layout>.
...
Log file name will be of the format : <modulename>log.txt.0<0,1>
Log file for a particular module can be easily identified from the name of the log file. Example: TR69log.txt.0
...
rdklogs/logs will be periodically checked for the maximum size set for the logs to be uploaded.(“rdkbLogMonitor.sh” script file monitor this functionality)
In RDKB RDK-B maximum size of log directory is set to 1.5MB. This value is chosen based on storage constraints for the target platform. Can be changed to any value based on storage availability.
...
ATOM processor components log messages are passed as a parameter to CcspLogAgent component via D-bus. Then CcspLogAgent routs the logs to rdklogger.
Example: In some of the devices WifiAgent component runs on the ATOM processor
...
...
Steps to add the rdklogger to a new component:
Step 1:
Need to add LoggerEnable and LogLevel parameters in “LogAgent.xml” file for new component.
Code Block |
---|
X_RDKCENTRAL-COM_New_LoggerEnable |
...
X_RDKCENTRAL-COM_New_LogLevel |
Step 2:
Need to add the new parameters in “system_defaults_arm” file for persistent storage.
Code Block |
---|
$ X_RDKCENTRAL-COM_New_LogLevel=4 |
...
$ X_RDKCENTRAL-COM_New_LoggerEnable=1 |
Write Code functionality for Loglevel & LoggerEnable parameters set/get in “cosa_apis_logagentplugin.c” file
Initialize Initialise rdklogger by calling rdk_logger_init (/fss/gw/lib/debug.ini) in the NEW new component
Step 3:
Add new component entry in “rdkb_debug.ini” file
Code Block |
---|
LOG.RDK.New = ALL FATAL ERROR WARNING NOTICE INFO DEBUG TRACE |
Step 4:
Add the below configuration in “rdkb_log4src” file for new component
...
RDK Logger is available in the below path,
../source_code/components/generic/rdk_logger
Below bitbake commands are used for building rdk-logger,
Panel |
---|
$ bitbake -c compile -f rdk-logger $ bitbake rdk-logger $ bitbake rdk-generic-broadband-image |
For Doxygen documentation on the RDK Logger please refer: Doxygen RDK Logger