问题描述
使用阿里云对象存储OSS Java SDK的ContentMD5提示如下错误:
log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.PoolingClientConnectionManager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/2.X/faq.html#noconfig for more info.:
解决方案
请参见以下操作进行处理:
log4j是Apache的服务,可在工程的src文件夹下面创建
log4j.properties
文件,内容如下所示。# Configure logging for testing: optionally with log file log4j.rootLogger=WARN, stdout # log4j.rootLogger=WARN, stdout, logfile log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.logfile=org.apache.log4j.FileAppender log4j.appender.logfile.File=target/spring.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n ===============================
添加此配置文件后,再次运行程序则不会在出现错误提示。
适用于
对象存储OSS
文档内容是否对您有帮助?