Updated on 2026-01-16 GMT+08:00

Configuring SDK Logging

OBS Android SDK provides the logging function based on the java.util.logging library. You can use LogConfigurator.enableLog to enable or use LogConfigurator.disableLog to disable the logging function. Sample code is as follows:

// Set the log level. The default value is LogConfigurator.WARN.
LogConfigurator.setLogLevel(LogConfigurator.INFO);

// Set the number of reserved log files. The default value is 10.
LogConfigurator.setLogFileRolloverCount(5);

// Set the size of each log file, in bytes. The size is not limited by default.
LogConfigurator.setLogFileSize(1024 * 1024 * 10);

// Set the directory for storing log files. The log files are saved in the logs directory of the SD card by default. In this sample, /storage/sdcard is used. You can change it as required.
LogConfigurator.setLogFileDir("/storage/sdcard");

// Enable logging.
LogConfigurator.enableLog();

// Disable logging.
LogConfigurator.disableLog();
  • The logging function is disabled by default. You need to enable it manually.
  • For details about SDK logs, see Log Analysis.
  • If no save directory of log files is configured, log files will be saved in the logs directory of the SD card, by default.