問題描述
使用阿里云對象存儲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
文檔內容是否對您有幫助?