Runtime Management of the Logging Framework

Dynamically switch the logging framework used in Dubbo at runtime

Note

Starting from 3.0.10, dubbo-qos runtime control supports querying logging configurations and dynamically modifying the logging framework and log levels used.

The logging configurations modified through dubbo-qos are not persistently stored and will be ineffective after application restarts.

Query Logging Configuration

Command: loggerInfo

Example:

  1. > telnet 127.0.0.1 22222
  2. > loggerInfo

Output:

  1. Trying 127.0.0.1...
  2. Connected to localhost.
  3. Escape character is '^]'.
  4. ___ __ __ ___ ___ ____
  5. / _ \ / / / // _ ) / _ ) / __ \
  6. / // // /_/ // _ |/ _ |/ /_/ /
  7. /____/ \____//____//____/ \____/
  8. dubbo>loggerInfo
  9. Available logger adapters: [jcl, jdk, log4j, slf4j]. Current Adapter: [log4j]. Log level: INFO

Change Log Level

Command: switchLogLevel {level}

level: ALL, TRACE, DEBUG, INFO, WARN, ERROR, OFF

Example:

  1. > telnet 127.0.0.1 22222
  2. > switchLogLevel WARN

Output:

  1. Trying 127.0.0.1...
  2. Connected to localhost.
  3. Escape character is '^]'.
  4. ___ __ __ ___ ___ ____
  5. / _ \ / / / // _ ) / _ ) / __ \
  6. / // // /_/ // _ |/ _ |/ /_/ /
  7. /____/ \____//____//____/ \____/
  8. dubbo>loggerInfo
  9. Available logger adapters: [jcl, jdk, log4j, slf4j]. Current Adapter: [log4j]. Log level: INFO
  10. dubbo>switchLogLevel WARN
  11. OK
  12. dubbo>loggerInfo
  13. Available logger adapters: [jcl, jdk, log4j, slf4j]. Current Adapter: [log4j]. Log level: WARN
  1. ### Change Logging Output Framework
  2. Command: `switchLogger {loggerAdapterName}`
  3. loggerAdapterName: `slf4j`, `jcl`, `log4j`, `jdk`, `log4j2`
  4. Example:

telnet 127.0.0.1 22222 switchLogger slf4j ```

Output:

  1. Trying 127.0.0.1...
  2. Connected to localhost.
  3. Escape character is '^]'.
  4. ___ __ __ ___ ___ ____
  5. / _ \ / / / // _ ) / _ ) / __ \
  6. / // // /_/ // _ |/ _ |/ /_/ /
  7. /____/ \____//____//____/ \____/
  8. dubbo>loggerInfo
  9. Available logger adapters: [jcl, slf4j, log4j, jdk]. Current Adapter: [log4j]. Log level: INFO
  10. dubbo>switchLogger slf4j
  11. OK
  12. dubbo>loggerInfo
  13. Available logger adapters: [jcl, slf4j, log4j, jdk]. Current Adapter: [slf4j]. Log level: INFO

Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)