Log4j configuration detail

    / **  
     * log4j basic configuration steps described: 
     * 1. introducing log4j jar package file associated.
          
     * 2. Create log4j configuration file. 
           

     * 3. The test configuration was successful.
            
*/
Log4j root configuration syntax
下面引入一个案例:
#log4j.rootLogger=DEBUG,CONSOLE,A
#log4j.addivity.org.apache=false
#
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.Threshold=debug
#log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} -%-4r [%t] %-5p %x - %m%n
#log4j.appender.CONSOLE.Target=System.out
#log4j.appender.CONSOLE.Encoding=gbk
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#
#
#log4j.appender.A=org.apache.log4j.DailyRollingFileAppender 
# log4j.appender.A.File = $ {} the catalina.home / logs / car_log / CarOperate_ 
# log4j.appender.A.DatePattern = the MM-YYYY-dd'.log ' 
# log4j.appender .A.layout = Org.apache.log4j.PatternLayout 
# log4j.appender.A.Encoding = UTF. 8- 
# log4j.appender.A.layout.ConversionPattern = [car_sys]% {D the mM-dd-YYYY HH \: mm \: SS 5P% C%} {}. 1 \:% L \:% m% n- 


# Description: 
# Log4j.rootLogger = [level], AppenderName, AppenderName, ... 
# level: logging priority is divided into OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL or level that you define. Log4j recommended to use only four levels, from highest to lowest priority are ERROR, WARN, INFO, DEBUG. Defined by the level here, you can control the switch to log the application of the appropriate level of information. For example, in the definition of the INFO level here, the application of all the DEBUG level log information will not be printed.
# AppenderName: Specify the log information is output to which place. You can specify multiple output destinations. Eg: In log4j.rootLogger = info, A1, B2, C3 places arranged three outputs (output destination where the name can be arbitrarily), but must be provided corresponding to the name of our later;
# Note: CONSOLE and wherein A is the output destination, where the two are carried out corresponding setting.
 

 

Guess you like

Origin www.cnblogs.com/tanjiyuan/p/11749936.html