log4j.xml示例

log4j.xml示例
<? xml version="1.0" encoding="UTF-8" ?>   
<! DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >   
< log4j:configuration  xmlns:log4j ="http://jakarta.apache.org/log4j/"  debug ="false" >   

  
< appender  name ="ROLLING"  class ="org.apache.log4j.RollingFileAppender" >   
      
< layout  class ="org.apache.log4j.PatternLayout" >   
          
< param  name ="ConversionPattern"  value ="%d %5p %c %x - %m%n"   />   
      
</ layout >   
      
< param  name ="File"  value ="example.log"   />
      
< param  name ="MaxFileSize"  value ="50MB"   />
      
< param  name ="MaxBackupIndex"  value ="9"   />
  
</ appender >
      
  
< appender  name ="CONSOLE"  class ="org.apache.log4j.ConsoleAppender" >   
      
< layout  class ="org.apache.log4j.PatternLayout" >   
          
< param  name ="ConversionPattern"  value ="%d %5p %c %x - %m%n"   />   
      
</ layout >   
      
< param  name ="Threshold"  value ="info"   />
  
</ appender >

  
< appender  name ="ASYNC"  class ="org.apache.log4j.AsyncAppender" >   
      
< param  name ="BufferSize"  value ="10000"   />   
      
< param  name ="Blocking"  value ="false"   />
      
< appender-ref  ref ="ROLLING"   />   
      
< appender-ref  ref ="CONSOLE"   />
  
</ appender >   
       
  
< root >   
      
< level  value ="info"   />   
      
< appender-ref  ref ="ASYNC"   />   
  
</ root >   
      
  
< logger  name ="MyName" >   
      
< level  value ="debug" />   
  
</ logger >   
      
</ log4j:configuration >  

你可能感兴趣的:(log4j.xml示例)