Updated on 2026-08-14 GMT+08:00

Configuring SDK Logging (SDK for Java)

OBS Java SDK provides the logging function, based on the Apache Log4j2 open library. You can modify log configuration files to configure logging based on your needs.

Procedure

  1. Obtain the file log4j2.xml from the OBS SDK for Java package.
  2. Modify the log level and log storage path in the log4j2.xml file as required. The default log level is WARN, and the default log storage path is the path specified by the JDK system variable user.dir.
  3. Save the file to the classpath root directory, or call Log4j2Configurator.setLogConfig to specify the storage path of the file.
  • For details about SDK logging, see Log Analysis (SDK for Java).
  • You can modify the log4j2.xml file to configure access permissions for log files.