最简单的log4j配置文件

log4j.rootLogger=DEBUG, CONSOLE, FILE
## 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.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=D:/logs/log4j.log
log4j.appender.FILE.MaxFileSize=5MB
log4j.appender.FILE.Append = true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%t] %-5p %c(line-%L) %-4r %x - %m%n

你可能感兴趣的:(Java常用工具框架)