The OSS Java SDK depends on Apache HttpClient, which uses log4j internally for logging. If no log4j appender is configured in your project, the SDK emits the following warnings at startup:
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.:This is a standard log4j configuration issue, not a problem with ContentMD5 or the OSS SDK. Add a log4j.properties file to your project to suppress the warnings.
Solution
Step 1: Create the configuration file
Create a log4j.properties file under the src folder of the project.
# 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%nThis configuration routes WARN-level logs to the console (stdout). The logfile appender writes to target/spring.log — it is defined but disabled by default. To enable file logging, uncomment the second log4j.rootLogger line and comment out the first.
Step 2: Run your program
Rerun your program. The log4j warnings no longer appear.
Applicable scope
Object Storage Service (OSS)