Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

RDK Logger is a common logging library which is based on MPEOS logging & it uses log4c for formatting and supports multiple log levels

RDK Logger 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

RDK Logging architecture

...

Architecture

draw.io Diagram
diagramNameRDK_LOGGER_ARCHITECTURE.drawio
revision1


Log4c – Introduction & Terminology:

  • Framework which provides the capability to log messages in a variety of formats to console or local file
  • Configuration - Log4c can be configured using a configuration file
    • log4crc keeps configurations in xml format
    • Configurations can be provided for modules, sub modules etc.
  • Loggers - Named log message destinations which are known to applications.
  • Appenders - Responsible for delivering LogEvents to their destination.
  • Layouts & Filters determine how the message is formatted & filter the messages according to the configuration.

Logging Levels supported by RDK Logger

CodeDescription
RDK_LOG_FATALAny error that is forcing a shutdown of the service or application to prevent data loss (or further data loss), reserve these only for the most heinous errors and situations where there is guaranteed to have been data corruption or loss.
RDK_LOG_ERRORAny error which is fatal to the operation but not the service (cant open a file, missing data, etc)
RDK_LOG_WARNAnything that can potentially cause application oddities, but for which the application automatically recovering.
RDK_LOG_NOTICEAnything that largely superfluous for application-level logging.
RDK_LOG_INFOGenerally useful information to log (service start/stop, configuration assumptions, etc).
RDK_LOG_DEBUGInformation that is diagnostically helpful to people more than just developers.

RDK_LOG_TRACE1,

RDK_LOG_TRACE2,...

Only when it would be "tracing" the code and trying to find one part of a function specifically.

How to initialize RDK Logger

...

Example: -lrdkloggers -L ../opensource/lib -llog4c -lglib-2.0

RDK Logger Usage Format

RDK_LOG (rdk_LogLevel level, const char *module, const char *format,...)

...

In this way, user make use of the RDK logger in the respective modules and control the logging levels through configuration file. Here, No need to build RDK logger again for the addition of new components/module.

How to use logging in G-Streamer

...

A callback function gst_debug_add_log_function() is registered to receive GStreamer logs. 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

...

Default level for RDK logging is ERROR and logging settings are configured in /etc/debug.iniRDK components reads the configuration details from config file at the beginning.

LOG.RDK.<component1> = FATAL ERROR WARNING NOTICE INFO
LOG.RDK.<component2> = FATAL ERROR WARNING NOTICE INFO DEBUG

...

By default, stdout is redirected to /opt/logs/ocapri_log.txt for OCAP RI related logs. 

How log files are uploaded to server

RDK Log upload Process

Logs are uploaded to servers in following scenarios

  • When the box is rebooted
  • When an on-demand log request is made
  • When a regular nightly job is set up for the log uploads

the script uploadSTBLogs.sh is responsible for uploading the logs to the server. Logs are uploaded as tar files with sufficient information like Mac ID, date , timestamp. Log can be uploaded to server using scp or tftp protocol as per server requirement.

draw.io Diagram
diagramNameRDK Log upload Process.drawio
revision1

API Documentation 

 To know more about SoC/Application level APIs details use in RDK, refer the link  RDK LOGGER API DocumentationImage Removed