pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[feat][broker] Support dynamic update log level at runtime

Open ethqunzhong opened this issue 3 years ago • 8 comments

Motivation

As default, Broker log level set by log4j2.yaml with pulsar.log.level=info, if developers want to update log level to debug, need to Modify log42j.yaml#pulsar.log.level=debug and then restart Broker service.

This PR support developers dynamic update Broker log level at runtime,It is very useful for online trouble shooting without having to stop Broker service and start it again.

Modifications

  • add admin cli (bin/pulsar-admin brokers update-logger-level --classname ${CLASSNAME} --level ${LEVEL})
  • add rest endpoints (/admin/v2/brokers/log4j/{classname}/{level})

Verifying this change

  • Make sure that the change passes the CI checks.
  • This change added tests and can be verified as follows:org.apache.pulsar.admin.cli.PulsarAdminToolTest#brokers
  • works as expected on product environment.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (yes)
  • The admin cli options: (yes)
  • Anything that affects deployment: (no)

Documentation

  • [x] doc-not-needed

ethqunzhong avatar Feb 10 '22 03:02 ethqunzhong