How to change logging of a qpid broker without the need of restarting it

Solution Verified - Updated

Environment

  • MRG Messaging 2.0 or higher

Issue

  • Is it possible to online change logging of a running qpid broker? If so, how to achieve it?

Resolution

  • It is possible to change logging of a running qpid broker without restarting it, by sending proper QMF method.

  • Changing logging verbosity programatically.

    • See attached C++ program.
  • When rewriting the program to Java, be aware that Java clients older than 0.12 do not support QMF properly 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 setLogLevel QMF method 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 querying getLogLevel method:

        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-tool by either quit or pressing Ctrl+D.

  • General notes to log-enable option:

    • Syntax of the logging string directly follows log-enable option of qpid. Refer to MRG: how to change logging of qpidd for further details.
    • To set / enable multiple logging areas via QMF (either programmatically or via qpid-tool), it is necessary to call the relevant QMF method 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.

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

  1. Start qpidd with log-to-file set to some file.

  2. 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+"  
     $
    
  3. Check the qpidd logs.

  4. Change logging level and scope (even multiple times) as per the MRG: how to change logging of qpidd KCS article and observe qpidd logs.

  5. Try the same procedure using qpid-tool instead.

SBR
Components
Category

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.