Runtime Management of the Logging Framework

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:

> telnet 127.0.0.1 22222
> loggerInfo

Output:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
   ___   __  __ ___   ___   ____
  / _ \ / / / // _ ) / _ ) / __ \
 / // // /_/ // _  |/ _  |/ /_/ /
/____/ \____//____//____/ \____/
dubbo>loggerInfo
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:

> telnet 127.0.0.1 22222
> switchLogLevel WARN

Output:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
   ___   __  __ ___   ___   ____
  / _ \ / / / // _ ) / _ ) / __ \
 / // // /_/ // _  |/ _  |/ /_/ /
/____/ \____//____//____/ \____/
dubbo>loggerInfo
Available logger adapters: [jcl, jdk, log4j, slf4j]. Current Adapter: [log4j]. Log level: INFO
dubbo>switchLogLevel WARN
OK
dubbo>loggerInfo
Available logger adapters: [jcl, jdk, log4j, slf4j]. Current Adapter: [log4j]. Log level: WARN
``` ```

### Change Logging Output Framework

Command: `switchLogger {loggerAdapterName}`

loggerAdapterName: `slf4j`, `jcl`, `log4j`, `jdk`, `log4j2`

Example:

telnet 127.0.0.1 22222 switchLogger slf4j ```

Output:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
   ___   __  __ ___   ___   ____
  / _ \ / / / // _ ) / _ ) / __ \
 / // // /_/ // _  |/ _  |/ /_/ /
/____/ \____//____//____/ \____/
dubbo>loggerInfo
Available logger adapters: [jcl, slf4j, log4j, jdk]. Current Adapter: [log4j]. Log level: INFO
dubbo>switchLogger slf4j
OK
dubbo>loggerInfo
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)