常用log4j.properties配置文件
log4j.rootLogger = info,console
#指定serviceImpl层 日志输出
log4j.logger.com.sms.service.impl = info,D
log4j.logger.com.sms.aop=info,D
#输出到控制台
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 = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
#输出info文件到D盘
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = d://logs/log.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = debug
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
#log4j.logger.com.sms.mapper =trace,D
log4j.logger.com.sms.mapper =debug,D
全文完,感谢您的耐心阅读~
欢迎大家关注我的公众号