Versions Compared

Key

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

...

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.

Log4c

  • Log4c is a open source library for flexible logging to files.
  • Log4c init “log4c_init()” happens during rdklogger init.
  • Log4c loads its configurations from rdkb_log4crc file. This contains the logger information (log directory path, size, file name, etc..).
  • LOG4C_RCPATH environment variable holds the path to the log4crc configuration file. So we have to configure this environment variable without fail.
  • Currently this is mentioned in  cosa_start.sh file (export LOG4C_RCPATH=/rdklogger).

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>.

  • The <config> element controls the global log4c configuration. It has 3 sub elements. The <nocleanup> flag inhibits the log4c destructors routines. The <bufsize> element sets the buffer size used to format log4c_logging_event_t objects. If is set to 0, the allocation is dynamic (the <debug> element is currently unused).
  • The <category> element has 3 possible attributes: the category "name", the category "priority" and the category "appender". Future versions will handle multiple appenders per  category.
  • The <appender> element has 3 possible attributes: the appender "name", the appender "type", and the appender "layout".
  • The <layout> element has 2 possible attributes: the layout "name" and the layout "type".

...