当前位置:编程学习 > JAVA >>

log4j.properties,通常配置:

log4j.properties,通常配置:(网上流传大多有问题,特声明一下)


[plain]
 ### set log levels ### 
log4j.rootLogger = debug, stdout, D, E 
 
 
### console ### 
log4j.appender.stdout = org.apache.log4j.ConsoleAppender 
log4j.appender.stdout.Target = System.out 
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 
log4j.appender.stdout.layout.ConversionPattern = [%5p] [%-d{yyyy-MM-dd HH:mm:ss}] [%t] (%F:%L) -%m%n 
### debug file ### 
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender 
log4j.appender.D.File=${catalina.home}/logs/kepu925.log 
log4j.appender.D.DatePattern='.'yyyy-MM-dd'.log' 
log4j.appender.D.Append = true 
log4j.appender.D.Threshold = DEBUG 
log4j.appender.D.layout = org.apache.log4j.PatternLayout 
log4j.appender.D.layout.ConversionPattern = [%5p] [%-d{yyyy-MM-dd HH:mm:ss}] [%t] (%F:%L) -%m%n 
### error for sigle file ### 
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender 
log4j.appender.E.File=${catalina.home}/logs/kepu925_error.log 
log4j.appender.E.DatePattern='.'yyyy-MM-dd'.log' 
log4j.appender.E.Append = true 
log4j.appender.E.Threshold = ERROR 
log4j.appender.E.layout = org.apache.log4j.PatternLayout 
log4j.appender.D.layout.ConversionPattern = [%5p] [%-d{yyyy-MM-dd HH:mm:ss}] [%t] (%F:%L) -%m%n 

 

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,