当前位置:首页文章首页 IT学院 IT技术

log4j配置最新通用版

作者:  来源:  发布时间:2011-12-7 11:57:48  点击:

#log4j.rootLogger = [ level ] , appenderName, appenderName, ...

log4j.rootLogger = INFO, console, R

#level=INFO,all can be output

#console is set to be a ConsoleAppender

log4j.appender.console = org.apache.log4j.ConsoleAppender

#console have four patterns

#org.apache.log4j.HTMLLayout

#org.apache.log4j.PatternLayout

#org.apache.log4j.SimpleLayout

#org.apache.log4j.TTCCLayout

log4j.appender.console.layout = org.apache.log4j.PatternLayout

#define the output type

log4j.appender.console.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n

#file is set to output to a extra file

log4j.appender.R = org.apache.log4j.RollingFileAppender

#the absolute route of the log4j file

log4j.appender.R.File = ${webapp.root}/WEB-INF/demo.log

#the size

log4j.appender.R.MaxFileSize = 500KB

#back up a file

log4j.appender.R.MaxBackupIndex = 1

log4j.appender.R.layout = org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] - %m%n

文章评论

软件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z