Description
Provides common logging capability for all RDK components.
Capabilities
- Abstracts logging client from underlying logging utility.
- Dynamically enables/disables logging level at run time.
- Provides logging format that complies with the existing OCAP format (e.g. <timestamp> [mod=*, level=*]).
- Controls log level independently for each component/module.
- Enables logging globally via single configuration value.
- Controls initial log level for each component/module from configuration file (debug.ini) at startup.
- Prints formatted data to stdout.
- Separates logs into separate files based on "SEPARATE.LOGFILE.SUPPORT" configuration variable
Used By
All RDK Components
Uses
IARM
log4c
Used in Features
All
Interfaces
Add link to SVN or published/generated documentation
Contributors
Comcast
Code
Current Version - none
Change History - none
Known issues - none
OCAP RI Logs
By default, stdout is redirected to /opt/logs/ocapri_log.txt for OCAP RI related logs.
Initialization
- rdk_logger_init() loads entries from “debug.ini” and initializes log4c with Comcast dated format.
- Sets log level of the module corresponding to environment variables.
- Sets log level to default log levels, for the modules not having entries in configuration file. (Currently it is set as LOG.RDK.DEFAULT = ERROR in debug.ini)
Logging Configuration
Default level of logging is ERROR. But Logging settings are configured in debug.ini
...
LOG.RDK.<component2> = FATAL ERROR WARNING NOTICE INFO DEBUG
Log
...
Levels
- RDK_LOG_FATAL
- RDK_LOG_ERROR
- RDK_LOG_WARN
- RDK_LOG_NOTICE
- RDK_LOG_INFO
- RDK_LOG_DEBUG
- RDK_LOG_TRACE1
- RDK_LOG_TRACE2
- RDK_LOG_TRACE3
- RDK_LOG_TRACE4
- RDK_LOG_TRACE5
- RDK_LOG_TRACE6
- RDK_LOG_TRACE7
- RDK_LOG_TRACE8
- RDK_LOG_TRACE9
Usage
Use RDK_LOG debug message as.
...
Now, "mediaframework/qamsource/debug.ini" is no more in use, instead "rdklogger/debug.ini" is used and it gets copied to "/mnt/nfs/env"
How to add the rdklogger functionality to the new module
- Include rdk_debug.h header file and make use of RDK_LOG for printing logs.
- Initialize rdklogger by calling rdk_logger_init() in the respective module/component.
- Build new module/component by linking "librdkloggers.so" along with "liblog4c.so" and "libglib-2.0.so" shared object
Example:
-lrdkloggers -L ../opensource/lib -llog4c -lglib-2.0
Gstreamer Logging
- A callback function is registered to receive gstreamer logs.
- gst_debug_add_log_function()
- Logs are converted to RDK logs in callback function.
- RMF element which controls a gst-element shall register element name and corresponding log module using
- void RMF_registerGstElementDbgModule(char *gst_module, char *rmf_module)
- Callback function uses this information to get module names corresponding to gstreamer logs.
...