<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Regarding logging concepts in nrf connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74202/regarding-logging-concepts-in-nrf-connect-sdk</link><description>Hi Nordic Team, 
 
 I am new to embedded developing and I am learning about logging data while working on nRF connect sdk&amp;quot; . 
 
 kit:nrf5340 
 SDK: nRF connect SDK v1.5.0 
 
 
 
 
 1. What is the configuration I need to add in prj.conf file , to print</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Apr 2021 09:19:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74202/regarding-logging-concepts-in-nrf-connect-sdk" /><item><title>RE: Regarding logging concepts in nrf connect SDK</title><link>https://devzone.nordicsemi.com/thread/306262?ContentTypeID=1</link><pubDate>Thu, 22 Apr 2021 09:19:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68cd8ba9-c316-49ea-9355-1ee2ae4ff8d5</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We have the page &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_logging.html"&gt;Logging in nRF Connect SDK&lt;/a&gt;&amp;nbsp;and the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/logging/index.html#logging"&gt;Logging API in Zephyr&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;First off, you can&amp;nbsp;select different logging backends: UART, RTT, Spinel or Shell. UART logging backend uses the UART interface to send the logging information. RTT backend uses &lt;a href="https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/"&gt;SEGGER&amp;#39;s JLink Real Time Transfer (RTT)&lt;/a&gt;&amp;nbsp;and requires a J-Link device (the nRF9160DK has this) and is very practical because, as opposed to the UART backend, it doesn&amp;#39;t occupy an UART instance in your application. I&amp;#39;m not that familiar with Spinel, but it&amp;#39;s specific to OpenThread&amp;#39;s NCP and RCP architectures so it might not be relevant for you. Enabling Zephyr&amp;#39;s Shell automatically makes it a logging backend. The&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/shell/index.html#shell"&gt;Zephyr Shell&lt;/a&gt;&amp;nbsp;is a module in Zephyr similar to the Unix shell with certain features that you are listed in the documentation.&lt;/p&gt;
&lt;p&gt;The UART and RTT logging backends can also be configured as shell backends.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The minimal configuration you need to enable logging is &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/subsys/logging/Kconfig#L4"&gt;CONFIG_LOG&lt;/a&gt;. Then you can use the function &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/logging/index.html#c.LOG_INF"&gt;LOG_INF()&lt;/a&gt;, as long as you make sure&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_LOG_DEFAULT_LEVEL.html#cmdoption-arg-CONFIG_LOG_DEFAULT_LEVEL"&gt;CONFIG_LOG_DEFAULT_LEVEL&lt;/a&gt;&amp;nbsp;is 3 or larger, so the module will print LOG_INF() messages and other &amp;quot;less severe&amp;quot; log messages as well (see&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/subsys/logging/Kconfig.filtering#L22-L26"&gt;zephyr/subsys/logging/Kconfig.filtering L22-L26&lt;/a&gt;&amp;nbsp;for the different levels).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;All samples in NCS has the configuration&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_NCS_SAMPLES_DEFAULTS.html#cmdoption-arg-CONFIG_NCS_SAMPLES_DEFAULTS"&gt;CONFIG_NCS_SAMPLES_DEFAULTS&lt;/a&gt;&amp;nbsp;enabled by default, which selects both CONFIG_LOG and CONFIG_LOG_MINIMAL.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;Modules that are split up over multiple files must have exactly one file use LOG_MODULE_REGISTER() to create module-specific state and register the module with the logger core. The other files in the module should use LOG_MODULE_DECLARE()&amp;nbsp;instead to&amp;nbsp;declare that same state. Otherwise, the functions LOG_INF() etc. will not be able to refer to module-specific state variables. So unless you&amp;#39;re writing your own module, you don&amp;#39;t need to consider this macro.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BT_LOG refers to the specific module with the name &amp;quot;BT, see &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/subsys/bluetooth/Kconfig#L17-L19"&gt;zephyr/subsys/bluetooth/Kconfig L17-L19&lt;/a&gt;.&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/logging/index.html#logging-in-a-module"&gt;Logging in a module&lt;/a&gt;&amp;nbsp;explains how logging configurations are created from module names. So BT_LOG enables logging for the specific module.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3. The different levels can be used regardless of which logging backend you are using.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. There are no samples explaining the logging, but the documentation I provided at the beginning of my comment contains a lot of information.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;5. &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/subsys/logging/Kconfig.template.log_config#L25"&gt;CONFIG_BT_LOG_LEVEL&lt;/a&gt;&amp;nbsp;will decide which of those commands (1 LOG_ERR(), 2 LOG_WRN(), 3 LOG_INF(), 4 LOG_DBG()) in the BT module will be filtered out. So for instance LOG_LEVEL 2 will only include logging information 1 LOG_ERR() and 2 LOG_WRN().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me know if that answered your questions!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>