How to change logging of a qpid broker without the need of restarting it
Environment
- MRG Messaging 2.0 or higher
Issue
- Is it possible to online change logging of a running
qpidbroker? If so, how to achieve it?
Resolution
-
It is possible to change logging of a running
qpidbroker without restarting it, by sending properQMFmethod. -
Changing logging verbosity programatically.
- See attached
C++program.
- See attached
-
When rewriting the program to Java, be aware that Java clients older than 0.12 do not support
QMFproperly due to this bug. -
Changing logging verbosity using
qpid-tool.-
Invoke
qpid-tool, wait 10 seconds (to let it populate by broker statistics generated every 10 seconds) and type list broker:$ qpid-tool qpid: list broker Object Summary: ID Created Destroyed Index ======================================= 115 05:06:56 - amqp-broker qpid: -
Now call
setLogLevelQMFmethod to the broker (specified by its ID returned in first column of previous output) with argument new logging verbosity. Optionally, check if the log level was applied by queryinggetLogLevelmethod:qpid: call 115 setLogLevel "trace:+SessionState,debug:amqp,info+" qpid: OK (0) - {} qpid: call 115 getLogLevel qpid: OK (0) - {u'level': 'trace:+SessionState,debug:amqp,info+'} qpid: -
Exit
qpid-toolby either quit or pressingCtrl+D.
-
-
General notes to
log-enableoption:- Syntax of the logging string directly follows
log-enableoption ofqpid. Refer to MRG: how to change logging of qpidd for further details. - To set / enable multiple logging areas via
QMF(either programmatically or viaqpid-tool), it is necessary to call the relevantQMFmethod just once and specifying all options together, separated by comma. Example:trace:+SessionState,debug:amqp,info+. - When enabling some specific logging only, do not forget to add
notice+to keep the default logging verbosity for general logs.
- Syntax of the logging string directly follows
Root Cause
There is a QMF method, setLogLevel, allowing to change logging verbosity of a running qpid. The method sets all logging according to its argument only, ignoring any other verbose logging previously set.
Diagnostic Steps
-
Start
qpiddwith log-to-file set to some file. -
Translate the attached program:
$ g++ -Wall -lqpidclient -lqpidcommon -lqpidmessaging -lqpidtypes -o set_log_level set_log_level.cpp $ In another terminal, watch tail of qpid logs. In the first terminal, change logging to "trace+": $ ./set_log_level "trace+" $ -
Check the
qpiddlogs. -
Change logging level and scope (even multiple times) as per the MRG: how to change logging of qpidd KCS article and observe
qpiddlogs. -
Try the same procedure using
qpid-toolinstead.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.