Overview
Features
Download
Documentation
Community
Add-Ons & Services

Setting logger priority level from XML config file

A general discussion forum.

Setting logger priority level from XML config file

Postby sampsont » 07 May 2009, 15:45

Is it possible to add something to this config file to set the priority level to 'trace'?
Code: Select all
<application>
   <logging>
      <formatters>
         <f1>
            <class>PatternFormatter</class>
      
            <!-- <pattern>%m/%d/%Y %H:%M:%S.%i %s.%p %t</pattern> -->
            <pattern>%s.%p %t</pattern>
      
            <times>UTC</times>
         </f1>
         <f2>
            <class>PatternFormatter</class>
    
            <pattern>##[%s, %p]## %t</pattern>
      
            <times>UTC</times>
         </f2>
      </formatters>
      <channels>
         <c1>
            <class>ConsoleChannel</class>
            <formatter>f2</formatter>
         </c1>
         <c2>
         <class>FileChannel</class>
         <path>debug.log</path>
         <formatter>f1</formatter>
         </c2>
         <c3>
         <class>SyslogChannel</class>
         <name>m9kservd</name>
         <facility>SYSLOG_USER</facility>
         </c3>
         <c4>
          <class>SplitterChannel</class>
            <channel>c1,c2,c3</channel>
         </c4>
      </channels>
      <loggers>
            <Application>
               <name>Application</name>
               <channel>c4</channel>
            </Application>
      </loggers>
   </logging>
</application>


I can do it programatically with Application::instance().logger().setLevel("trace"); but it usually makes more sense to set the priority at run-time.
Thanks
sampsont
 
Posts: 31
Joined: 05 Mar 2009, 17:08

Re: Setting logger priority level from XML config file

Postby WittrockJ » 07 May 2009, 16:32

Try this. An example of this is also shown in the LoggingConfigurator documentation.
Code: Select all
     
<loggers>
   <Application>
      <name>Application</name>
      <channel>c4</channel>
      <level>trace</level>
   </Application>
</loggers>


-Wittrock
WittrockJ
 
Posts: 5
Joined: 07 May 2009, 16:15

Re: Setting logger priority level from XML config file

Postby sampsont » 07 May 2009, 17:09

Thanks Jeff :)
sampsont
 
Posts: 31
Joined: 05 Mar 2009, 17:08


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron