1....在resources下添加:new -----> file ------> log4j.properties
1 # Set root category priority to INFO and its only appender to CONSOLE. 2 #log4j.rootCategory=INFO, CONSOLE debug info warn error fatal 3 log4j.rootCategory=debug, CONSOLE, LOGFILE, info 4 5 # Set the enterprise logger category to FATAL and its only appender to CONSOLE. 6 log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE 7 8 # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 9 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 10 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 11 log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m 12 13 # LOGFILE is set to be a File appender using a PatternLayout. 14 log4j.appender.LOGFILE=org.apache.log4j.FileAppender 15 log4j.appender.LOGFILE.File=E:idea/test02/message.log 16 log4j.appender.LOGFILE.Append=true 17 log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 18 log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m
2...
log4j.appender.LOGFILE.File=E:idea/test02/message.log 日志信息输出位置:需要更改,(定期清理----哦!!!)