1. 程式人生 > >log4j 史上最簡單的配置

log4j 史上最簡單的配置

log4j.properties 檔案內容:具體需求課根據自己的意願選擇不同的許可權

# Log4j properties
log4j.rootLogger=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.Threshold=INFO
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout
.layout.ConversionPattern=%d %p [%c,%L] - %m%n #log4j.appender.logfile.encoding=UTF-8 #log4j.appender.logfile=org.apache.log4j.RollingFileAppender #log4j.appender.logfile.File=${lms.root}/WEB-INF/logs/lms.log #log4j.appender.logfile.MaxFileSize=512KB # Keep three backup files. #log4j.appender.logfile.MaxBackupIndex=3
# Pattern to output: date priority [category] - message #log4j.appender.logfile.layout=org.apache.log4j.PatternLayout #log4j.appender.logfile.layout.ConversionPattern=%d %p [%c,%L] - %m%n log4j.logger.org.hibernate=INFO log4j.logger.org.springframework=INFO log4j.logger.com.opensymphony.xwork2=INFO log4j.logger
.org.apache.struts2=INFO