RollingFileAppender和DailyRollingFileAppender
RollingFileAppender:按log文件最大长度限度生成新文件
DailyRollingFileAppender:按日期生成新文件
# Root logger set to ERROR using the Console appender defined above.
# log level : ALL DEBUG INFO WARN ERROR OFF
# INFO %d{yyyy-MM-dd HH:mm:ss} %m%n
# OTHER %d{yyyy-MM-dd HH:mm:ss} [%t] [%c] %p: %m%n
log4j.rootLogger=INFO,CONSOLE,X5
###################
Console Appender
###################
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %m%n
########################
X5 File
########################
log4j.appender.X5=org.apache.log4j.RollingFileAppender
log4j.appender.X5.File=${JUSTEP_LOG_HOME}/justep.baas.log
log4j.appender.X5.MaxFileSize=10MB
log4j.appender.X5.MaxBackupIndex=10
log4j.appender.X5.layout=org.apache.log4j.PatternLayout
log4j.appender.X5.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] [%c] %p: %m%n
原文链接:https://www.f2er.com/note/422114.html