All Products
Search
Document Center

ApsaraMQ for RocketMQ:Log configuration

Last Updated:Mar 10, 2026

ApsaraMQ for RocketMQ SDKs generate client logs that record runtime events and exceptions. Use these logs to troubleshoot issues during client operation.

Default log file paths

The following table lists the default log file path for each SDK language. {$HOME} is the root directory of the application that you started.

LanguageDefault path
Java{$HOME}/logs/rocketmq/rocketmq-client.log
C++{$HOME}/logs/rocketmq/client.log
C#{$HOME}/logs/rocketmq/rocketmq-client.log
Go{$HOME}/logs/rocketmq/rocketmq_client_go.log

Log parameters

After the client starts, it creates a log file based on default settings. The Java and Go SDKs support custom log parameters. The C++ and C# SDKs do not support custom log configuration.

Java

All Java log parameters are set through JVM system properties (-D flags).

ParameterDescriptionDefaultValid values
rocketmq.log.levelLog verbosity level.INFOERROR, WARN, INFO, DEBUG
rocketmq.log.rootRoot directory for log output.{$HOME}/logs/rocketmqAny local directory with write permissions.
rocketmq.log.file.maxIndexMaximum number of log files to retain. Each log file has a fixed maximum size of 64 MB.101--100. Values outside this range or in an invalid format fall back to the default.
Note

Make sure that the application process has write permissions on the specified log directory. Otherwise, logs cannot be printed.

Go

Go log parameters are set through environment variables.

ParameterDescriptionDefaultValid values
rocketmq.client.logLevelLog verbosity level.INFOERROR, WARN, INFO, DEBUG
rocketmq.client.logRootRoot directory for log output.{$HOME}/logs/rocketmqAny local directory with write permissions.
rocketmq.client.logFileNameLog file name.rocketmq_client_go.logAny valid file name.
rocketmq.log.file.maxIndexMaximum number of log files to retain.101--100
rocketmq.client.logFileMaxSizeMaximum size of each log file.1 GB--
Note

Make sure that the application process has write permissions on the specified log directory. Otherwise, logs cannot be printed.

Configure logging

Java

In the startup script or IDE VM options, pass -D flags to set log parameters.

Set the log level to INFO:

java -Drocketmq.log.level=INFO -jar foobar.jar

Set a custom log directory and increase file retention:

java -Drocketmq.log.level=WARN \
     -Drocketmq.log.root=/var/log/myapp/rocketmq \
     -Drocketmq.log.file.maxIndex=20 \
     -jar foobar.jar

Go

The Go SDK supports two configuration methods:

  • Static configuration -- Set environment variables before starting the client.

  • Dynamic configuration -- Set environment variables in code and call ResetLogger() to apply changes at runtime.

Dynamic configuration (change at runtime):

os.Setenv("rocketmq.client.logLevel", "WARN")
rmq_client.ResetLogger()