<?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>Use different logging modules with different log levels</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94361/use-different-logging-modules-with-different-log-levels</link><description>Hello, 
 I want to use standalone logging for each file (/module)(/driver) of my program, therefore register different logging modules with different log levels each. Registering modules isn&amp;#39;t the problem, but if I initialize different modules their log</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Nov 2022 13:46:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94361/use-different-logging-modules-with-different-log-levels" /><item><title>RE: Use different logging modules with different log levels</title><link>https://devzone.nordicsemi.com/thread/398352?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2022 13:46:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5d91dd2-cc0e-4a79-aef0-335d784cd01a</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can register multiple log modules, with their own log level.&lt;/p&gt;
&lt;p&gt;You can see how this can be done in the asset_tracker_v2 application.&lt;/p&gt;
&lt;p&gt;E.g in main.c you have&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;zephyr/logging/log_ctrl.h&amp;gt;

LOG_MODULE_REGISTER(MODULE, CONFIG_APPLICATION_MODULE_LOG_LEVEL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;while in watchdog/watchdog_app.c you have&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/logging/log.h&amp;gt;
LOG_MODULE_REGISTER(watchdog, CONFIG_WATCHDOG_LOG_LEVEL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;CONFIG_APPLICATION_MODULE_LOG_LEVEL and CONFIG_WATCHDOG_LOG_LEVEL is defined by the the project Kconfig and src/watchdog/Kconfig respectively&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;module = APPLICATION_MODULE
module-str = Application module
source &amp;quot;subsys/logging/Kconfig.template.log_config&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;module = WATCHDOG
module-str = Watchdog
source &amp;quot;subsys/logging/Kconfig.template.log_config&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>