Changes between Version 28 and Version 29 of ProgrammingGuidelines


Ignore:
Timestamp:
07/12/11 15:54:49 (8 years ago)
Author:
welberge
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProgrammingGuidelines

    v28 v29  
    6666} 
    6767}}} 
     68 
    6869=== Logging exceptions === 
    6970SLF4J can log the Exception trace using: 
     
    7273}}} 
    7374 
     75=== Hierarchical logging === 
     76Like most loggers SLF4J allows one to set the log level, log destination and 
     77log format based on the name of the logger. The 
     78naming scheme allows setting up level, destination and format for a group of 
     79loggers. For example, one could redirect the logging of loggers 
     80hmi.elckerlyc.PegBoard, hmi.elckerlyc.animationengine.GazeMU and 
     81hmi.elckerlyc.animationengine.AnimationPlanPlanner\\  
     82by redirecting hmi.elckerlyc, or one could redirect only hmi.elckerlyc.animationengine.GazeMU 
     83and hmi.elckerlyc.animationengine.AnimationPlanPlanner 
     84by redirecting hmi.elckerlyc.animationengine. 
     85Example Send all output to with level >= 
     86INFO to the test.html file. In addition, log all output from hmi.elckerlyc with 
     87level >= DEBUG to the stdout: 
     88{{{ 
     89<configuration debug="true"> 
     90  <appender name="FILE" class="ch.qos.logback.core.FileAppender"> 
     91    <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> 
     92      <layout class="ch.qos.logback.classic.html.HTMLLayout"> 
     93          <pattern>%relative%thread%mdc%level%logger%msg</pattern> 
     94      </layout> 
     95    </encoder> 
     96    <file>test.html</file> 
     97  </appender> 
     98  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> 
     99    <encoder> 
     100      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> 
     101    </encoder> 
     102  </appender> 
     103  <root level="INFO"> 
     104    <appender-ref ref="FILE" /> 
     105  </root> 
     106  <logger name="hmi.elckerlyc" level="DEBUG"> 
     107    <appender-ref ref="STDOUT" /> 
     108  </logger> 
     109</configuration> 
     110}}} 
    74111[[ViewTopic()]] 
    75112!^[[ElckerlycDocumentation]]