
{"id":9983,"date":"2022-06-21T09:10:36","date_gmt":"2022-06-21T09:10:36","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/documentation\/rdk_video_documentation\/components\/open-sourced_components\/rdk_logger\/"},"modified":"2025-03-25T05:18:36","modified_gmt":"2025-03-25T05:18:36","slug":"rdk_logger","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/","title":{"rendered":"RDK Logger"},"content":{"rendered":"<p><br \/>\n <\/p>\n<div class=\"toc-macro client-side-toc-macro  conf-macro output-block\" data-headerelements=\"H1,H2,H3,H4,H5,H6,H7\" data-hasbody=\"false\" data-macro-name=\"toc\"> <\/div>\n<p>RDK Logger is a common logging library which is based on MPEOS logging &amp; it uses log4c for formatting and supports multiple log levels<\/p>\n<h3 id=\"RDKLogger-RDKLoggerCapabilities\">RDK Logger Capabilities<\/h3>\n<ul>\n<li class=\"O2\">Abstracts logging client from underlying logging utility.<\/li>\n<li class=\"O2\">Dynamically enables\/disables logging level at run time.<\/li>\n<li class=\"O2\">Provides logging format that complies with the existing OCAP format (e.g. &lt;timestamp&gt; [mod=*, level=*]).<\/li>\n<li class=\"O2\">Controls log level independently for each component\/module.<\/li>\n<li>Enables logging globally via single configuration value.<\/li>\n<li>Controls initial log level for each component\/module from configuration file (debug.ini) at startup.<\/li>\n<li>Prints formatted data to stdout.<\/li>\n<li>Separates logs into separate files based on &#8220;<strong>SEPARATE.LOGFILE.SUPPORT<\/strong>&#8221; configuration variable<\/li>\n<\/ul>\n<h3 id=\"RDKLogger-Architecture\">Architecture<\/h3>\n<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/RDK_LOGGER_ARCHITECTURE.drawio.png\"><\/p>\n<h3 id=\"RDKLogger-Log4c&ndash;Introduction&amp;Terminology:\">Log4c &ndash; Introduction &amp; Terminology:<\/h3>\n<ul>\n<li>Framework which provides the capability to log messages in a variety of formats to console or local file<\/li>\n<li>Configuration &#8211; Log4c can be configured using a configuration file\n<ul>\n<li>log4crc keeps configurations in xml format<\/li>\n<li>Configurations can be provided for modules, sub modules etc.<\/li>\n<\/ul>\n<\/li>\n<li>Loggers &#8211; Named log message destinations which are known to applications.<\/li>\n<li>Appenders &#8211; Responsible for delivering LogEvents to their destination.<\/li>\n<li>Layouts &amp; Filters determine&nbsp;how&nbsp;the&nbsp;message&nbsp;is&nbsp;formatted &amp; filter the messages according to the configuration.<\/li>\n<\/ul>\n<h3 id=\"RDKLogger-LoggingLevelssupportedbyRDKLogger\">Logging Levels supported by RDK Logger<\/h3>\n<div class=\"table-wrap\">\n\n\n<table class=\"wrapped confluenceTable\"><colgroup><col><col><\/colgroup><tbody><tr><th class=\"confluenceTh\">Code<\/th><th class=\"confluenceTh\">Description<\/th><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_FATAL<\/td><td class=\"confluenceTd\">Any 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.<\/td><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_ERROR<\/td><td class=\"confluenceTd\">Any error which is fatal to the operation but not the service (cant open a file, missing data, etc)<\/td><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_WARN<\/td><td class=\"confluenceTd\">Anything that can potentially cause application oddities, but for which the application automatically recovering.<\/td><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_NOTICE<\/td><td class=\"confluenceTd\">Anything that largely superfluous for application-level logging.<\/td><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_INFO<\/td><td class=\"confluenceTd\">Generally useful information to log (service start\/stop, configuration assumptions, etc).<\/td><\/tr><tr><td class=\"confluenceTd\">RDK_LOG_DEBUG<\/td><td class=\"confluenceTd\">Information that is diagnostically helpful to people more than just developers.<\/td><\/tr><tr><td class=\"confluenceTd\"><p>RDK_LOG_TRACE1,<\/p><p>RDK_LOG_TRACE2,&#8230;<\/p><\/td><td class=\"confluenceTd\">Only when it would be &#8220;tracing&#8221; the code and trying to find one part of a function specifically.<\/td><\/tr><\/tbody><\/table>\n\n\n<\/div>\n<h3 id=\"RDKLogger-HowtoinitializeRDKLogger\">How to initialize RDK Logger<\/h3>\n<ul>\n<li>&nbsp;rdk_logger_init() loads entries from &ldquo;debug.ini&rdquo; and initializes log4c.<\/li>\n<li>&nbsp;Sets log level of the module corresponding to environment variables.<\/li>\n<li>&nbsp;Sets log level to default log levels, for the modules not having entries in configuration file. (Currently it is set as<strong>&nbsp;LOG.RDK.DEFAULT = ERROR<\/strong>&nbsp;in debug.ini)<\/li>\n<\/ul>\n<h3 id=\"RDKLogger-Howtoaddtheloggerfunctionalitytothenewmodule?\">How to add the logger functionality to the new module?<\/h3>\n<p>Include rdk_debug.h header file and make use of RDK_LOG for printing logs. Initialize RDK Logger by calling rdk_logger_init() in the respective module\/component. Build new module\/component by linking &#8220;librdkloggers.so&#8221; along with &#8220;liblog4c.so&#8221; and &#8220;libglib-2.0.so&#8221; shared object.<\/p>\n<p>Example: -lrdkloggers -L ..\/opensource\/lib -llog4c -lglib-2.0<\/p>\n<h3 id=\"RDKLogger-RDKLoggerUsageFormat\">RDK Logger Usage Format<\/h3>\n<p>RDK_LOG (rdk_LogLevel level, const char *module, const char *format,&#8230;)<\/p>\n<ul>\n<li>&#8220;level&#8221; is Log level of the log message (FATAL, ERROR etc). Apart from this there are special log levels like ALL, NONE, TRACE, !TRACE are supported.<\/li>\n<li>&#8220;module&#8221; is the Module to which this message belongs to (Use module name same as mentioned in debug.ini)<\/li>\n<li>&#8220;format&#8221; is a printf style string containing the log message.<\/li>\n<\/ul>\n<p>All the RDK components logs are stored under \/opt\/log\/ with a naming convention &lt;RDK component&gt;=&#8221;&#8221;&gt;_log.txt. <br \/>For example, \/opt\/log\/pod_log.txt includes all events logged by POD Manager module.<\/p>\n<p><strong>Sample code for Logging<\/strong><\/p>\n<p>For example, add a debug messages for &#8220;INBSI&#8221; module<\/p>\n<p>RDK_LOG (RDK_LOG_NOTICE, &#8220;LOG.RDK.INBSI&#8221;,&#8221;&lt;%s: %s&gt;: Sending PMT_ACQUIRED eventn&#8221;, PSIMODULE, __FUNCTION__);<\/p>\n<p>User needs to provide the module name &#8220;LOG.RDK.INBSI&#8221;, which is the same as mentioned in debug.ini<\/p>\n<p>$ cat debug.ini<br \/>EnableMPELog = TRUE<br \/>LOG.RDK.INBSI = ALL FATAL ERROR WARNING NOTICE INFO DEBUG<\/p>\n<h3 id=\"RDKLogger-Sampleloggingoutput\">Sample logging output<\/h3>\n<p>131011-21:21:49.578394 [mod=INBSI, lvl=NOTICE] [tid=4141] &lt;SITP_PSI: NotifyTableChanged&gt;: Sending PMT_ACQUIRED event<\/p>\n<p>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.<\/p>\n<h3 id=\"RDKLogger-HowtouselogginginG-Streamer\">How to use logging in G-Streamer<\/h3>\n<p>A callback function gst_debug_add_log_function() is registered to receive GStreamer logs.&nbsp;Logs are converted to RDK logs in callback function.&nbsp;RMF element which controls a gst-element shall register element name and corresponding log module using<\/p>\n<p>void RMF_registerGstElementDbgModule(char *gst_module, char *rmf_module)<\/p>\n<p>Callback function uses this information to get module names corresponding to gstreamer logs.<\/p>\n<h3 id=\"RDKLogger-RDKLoggingConfiguration\">RDK Logging Configuration<\/h3>\n<p>Default level for RDK logging is ERROR and logging settings are configured in <strong>\/etc\/debug.ini.&nbsp;<\/strong>RDK components reads the configuration details from config file at the beginning.<\/p>\n<p>LOG.RDK.&lt;component1&gt; = FATAL ERROR WARNING NOTICE INFO<br \/>LOG.RDK.&lt;component2&gt; = FATAL ERROR WARNING NOTICE INFO DEBUG<\/p>\n<p><strong>For Example:<\/strong><\/p>\n<p>LOG.RDK.UI = NONE<br \/>LOG.RDK.QAMSRC = ALL FATAL ERROR<br \/>LOG.RDK.VODSRC = ALL FATAL ERROR WARNING NOTICE INFO<br \/>LOG.RDK.MS = ALL FATAL ERROR WARNING INFO<br \/>LOG.RDK.GSTQAM = ALL FATAL ERROR WARNING INFO<br \/>LOG.RDK.IPPV = ALL FATAL ERROR WARNING NOTICE INFO<br \/>LOG.RDK.RMFBASE = FATAL ERROR WARNING INFO<br \/>LOG.RDK.TRM =&nbsp;ALL FATAL ERROR WARNING NOTICE INFO<\/p>\n<h3 id=\"RDKLogger-Whichpathlogsarestored\">Which path logs are stored<\/h3>\n<p>By default, stdout is redirected to&nbsp;<strong>\/opt\/logs\/ocapri_log.txt<\/strong>&nbsp;for OCAP RI related logs.&nbsp;<\/p>\n<h3 id=\"RDKLogger-RDKLoguploadProcess\">RDK Log upload Process<\/h3>\n<p>Logs are uploaded to servers in following scenarios<\/p>\n<ul>\n<li>When the box is rebooted<\/li>\n<li>When an on-demand log request is made<\/li>\n<li>When a regular nightly job is set up for the log uploads<\/li>\n<\/ul>\n<p>the script uploadSTBLogs.sh is responsible for uploading the logs to the server.&nbsp;Logs are uploaded as tar files with sufficient information like Mac ID, date , timestamp.&nbsp;Log can be uploaded to server using scp or tftp protocol as per server requirement.<\/p>\n<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/RDK%20Log%20upload%20Process.drawio.png\"><\/p>\n<h3 id=\"RDKLogger-APIDocumentation\">API Documentation&nbsp;<\/h3>\n<p>&nbsp;To know more about SoC\/Application level APIs details use in RDK, refer the link&nbsp;&nbsp;<a href=\"https:\/\/wiki.rdkcentral.com\/doxygen\/rdkv-opensourced\/db\/d36\/group___r_d_k_l_o_g_g_e_r.html\" rel=\"nofollow\">RDK LOGGER API Documentation<\/a><\/p>\n<p><\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>RDK Logger is a common logging library which is based on MPEOS logging &amp; it [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"parent":9844,"menu_order":24,"comment_status":"open","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-9983","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RDK Logger - RDK Documentation Portal | Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RDK Logger - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"RDK Logger is a common logging library which is based on MPEOS logging &amp; it [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/\" \/>\n<meta property=\"og:site_name\" content=\"RDK Documentation Portal | Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-25T05:18:36+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/\",\"name\":\"RDK Logger - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2022-06-21T09:10:36+00:00\",\"dateModified\":\"2025-03-25T05:18:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RDK Video\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Components\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"RDK Logger\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/\",\"name\":\"RDK Documentation Portal | Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RDK Logger - RDK Documentation Portal | Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/","og_locale":"en_US","og_type":"article","og_title":"RDK Logger - RDK Documentation Portal | Documentation","og_description":"RDK Logger is a common logging library which is based on MPEOS logging &amp; it [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/","og_site_name":"RDK Documentation Portal | Documentation","article_modified_time":"2025-03-25T05:18:36+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/","name":"RDK Logger - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2022-06-21T09:10:36+00:00","dateModified":"2025-03-25T05:18:36+00:00","breadcrumb":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/rdk_logger\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":3,"name":"RDK Video","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/"},{"@type":"ListItem","position":4,"name":"Components","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/"},{"@type":"ListItem","position":5,"name":"RDK Logger"}]},{"@type":"WebSite","@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website","url":"https:\/\/developer.rdkcentral.com\/documentation\/","name":"RDK Documentation Portal | Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/comments?post=9983"}],"version-history":[{"count":3,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9983\/revisions"}],"predecessor-version":[{"id":11676,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9983\/revisions\/11676"}],"up":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9844"}],"wp:attachment":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/media?parent=9983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}