欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

Log4j异常处理

时间:2023-04-27
Log4j异常处理 log4j:WARN No appenders could be found for logger (com.alibaba.excel.metadata.property.ExcelHeadProperty)、log4j:WARN Please initialize the log4j system properly、log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info、1.加log4j依赖

org.slf4j slf4j-log4j12 1.7.25

2.在resources下创建 log4j.properties文件

### direct log messages to stdout ###log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target=System.outlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### direct messages to file mylog.log ###log4j.appender.file=org.apache.log4j.FileAppenderlog4j.appender.file.File=/Users/hapipipi/logslog4j.appender.file.layout=org.apache.log4j.PatternLayoutlog4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### set log levels - for more verbose logging change 'info' to 'debug' ###log4j.rootLogger=debug, stdout

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。