Introduction

All components have separate TR181 parameters to control the  LogLevels  and  LoggerEnable  options during run-time.                                                                                                  

All components logger TR181 parameters exist in LogAgent.xml file which is handled by CcspLogAgent component. Those parameters are stored in syscfg.db file for persistent storage.

  • LoggerEnable: This will help to enable/disable logs for particular component. If it is TRUE logs are enabled otherwise logs are disabled.

Note: We can enable/disable logging for the all components based on “X_RDKCENTRAL-COM_LoggerEnable” parameter. It is by default set to “TRUE”.

  • LogLevels: We can set different log levels for each component. By default all modules log level is 4 (RDK_LOG_INFO).

    CcspLogAgent component provides the ability to change the log levels at run time for individual components.

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.

Note: Log level for all components can be controlled using “X_RDKCENTRAL-COM_LogLevel” parameter. It is by default set to level 4 which is RDK_LOG_INFO.


RDK-B Logger Architecture



Example:

TR069 parameters for RDK logger,

Device.LogAgent.X_RDKCENTRAL-COM_TR69_LoggerEnable

Device.LogAgent.X_RDKCENTRAL-COM_TR69_LogLevel

PAM Parameters for RDK logger,

Device.LogAgent.X_RDKCENTRAL-COM_PAM_LoggerEnable

Device.LogAgent.X_RDKCENTRAL-COM_PAM_LogLevel

Limitations :

Scenario 1:

1. Use the CFLAG "DISABLE_LOGAGENT" during compilation.
2. Set the log levels to "TRACE" in the debug.ini file.
3. Try to generate a the logs for any component.
4. An example would be to enable and disable the Device.ManagementServer.EnableCWMP parameter for TR069
Expected Result:
Logs should be generated in the TR69log.txt.0 file.
Actual Result:
Logs are generated in the TR69log.txt.0 file.
Scenario 2:

1. Do not use the CFLAG "DISABLE_LOGAGENT" during compilation.
2. Set the log levels to "7" for Device.LogAgent.X_RDKCENTRAL-COM_TR69_LogLevel and "true" for Device.LogAgent.X_RDKCENTRAL-COM_TR69_LoggerEnable.
3. Try to generate a the logs for the TR069 component.
4. An example would be to enable and disable the Device.ManagementServer.EnableCWMP parameter for TR069
Expected Result:
Logs should be generated in the TR69log.txt.0 file.
Actual Result:
Logs are generated in the TR69log.txt.0 file.


2. So far, RPI boards supports only five ccsp components modules(PAM,PSM,WiFi,EthAgent,TR69).

3. Once we set the log level ,logger enable/disbale paramter by using dmcli .Immediately , that corresponding component will restart.

4. If we need to add any  CCSP components for logger support in future, we need to add those DM parameters in LogAgent.XML and cosa_apis_logagentplugin.c in CcspLogAgent Component. Also, those DM parameters are globally defined in CcspCommonLibrary Component in ansc_debug.c file.Please refer the below steps,

How to add rdklogger to a new component

Steps to add rdklogger to a new component:

Need to add LoggerEnable and LogLevel parameters in “LogAgent.xml” file for new component.

  • X_RDKCENTRAL-COM_New_LoggerEnable
  • X_RDKCENTRAL-COM_New_LogLevel

Need to add the new parameters in  “system_defaults_arm”  file for persistent storage.

$ X_RDKCENTRAL-COM_New_LogLevel=4

$ X_RDKCENTRAL-COM_New_LoggerEnable=1

Code functionality for Loglevel & LoggerEnable parameters set/get in “cosa_apis_logagentplugin.c” file

Initialise rdklogger by calling  rdk_logger_init (/fss/gw/lib/debug.ini)  in the new component

Add new component entry in “rdkb_debug.ini” file

LOG.RDK.New = ALL FATAL ERROR WARNING NOTICE INFO DEBUG TRACE

Add the below configuration in “rdkb_log4src” file for new component

<rollingpolicy name="New_rollingpolicy" type="sizewin" maxsize="2097152" maxnum="2"/>

<appender name="RI_Newrollingfileappender" type="rollingfile" logdir="/rdklogs/logs/"  prefix="Newlog.txt" layout="comcast_dated" rollingpolicy="New_rollingpolicy"/>

<category name="RI.Stack.New" priority="debug" appender=  "RI_Newrollingfileappender"/>

<category name="RI.Stack.LOG.RDK.New" priority="debug" appender=  "RI_Newrollingfileappender"/>




                                               

  • No labels