All Products
Search
Document Center

Object Storage Service:ContentMD5 Object Storage Service (OSS) using JAVA SDK prompts "log4j" error

Last Updated:May 11, 2022

Problem description

The following error message appears when you use ContentMD5 of the JAVA SDK.

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/1.2/faq.html#noconfig for more info.:

Solutions

  1. log4j is an Apache service. You can create a log4j.properties file under the src folder of the project. The content is as follows:
    # 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

    ===============================
  2. After adding this configuration file, running the program again will not cause an error message.

     

Applicable scope

  • Object Storage Service (OSS)