log4j 每天生产一个日志文件配置方法

log4j.rootLogger=DEBUG, CONSOLE, FILE,A1
## for console
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{MM-dd-HH:mm:ss}[%c-%L][%t][%-4r] - %m%n
## for file
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.encoding=GBK
log4j.appender.A1.file=D:/ftp/log/log-
log4j.appender.A1.DatePattern=yyyy-MM-dd'.log'
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{HH\:mm\:ss} [%p] %C.%M(%L) | %m%n

你可能感兴趣的:(log4j 每天生产一个日志文件配置方法)