MRG: how to change logging of qpidd

Solution Verified - Updated

Environment

  • MRG Messaging (any version)

Issue

  • How can I change verbosity and areas to be logged by qpid broker?

Resolution

  • Use --log-enable option with syntax:

--log-enable LEVEL[+][:PATTERN]

when running qpidd from command line, or

log-enable=LEVEL[+][:PATTERN]

when using configuration file. Note that command line option precedes configuration file option - see this solution for details.

  • LEVEL is one of: trace debug info notice warning error critical
  • The "+" means log the given severity and any higher severity (without the plus, logging of the given severity only will be enabled)
  • PATTERN is the scope of the logging change.
    • The string in PATTERN is matched against the fully-qualified name of the C++ function with the logging statement.
      • To see the fully-qualified name of the C++ function with the logging statement, either check source code or add to qpid configuration log-function=yes option and force qpid broker to log such message
    • So e.g. --log-enable debug+:cluster matches everything in the qpid::cluster module, while e.g. --log-enable debug+:broker::Queue::consumeNextMessage will enable logging of one particular method only (the consumeNextMessage method in the given namespace in this example).
    • PATTERN is often set to the module one needs to debug, like acl, amqp_0_10, broker, cluster, management or store.
  • The option can be used multiple times.
  • Be aware that having just one option like "log-enable=debug+:cluster" enables debug logs of cluster stuff, but does not produce any other logs; to add some more verbose logging, one should add such option like the above plus "artificially" add there the default value:

log-enable=notice+

  • To change logging verbosity of a running broker without the necessity to restart it, follow this solution.

Diagnostic Steps

  • Examples of adding some verbose logs (qpidd running from command line, while in qpid-stat -q is executed in another terminal):
$ qpidd --log-enable=debug+:SessionState::SessionState --log-enable=debug+:SessionState::detach
2013-10-25 11:34:59 [Broker] debug SessionState::SessionState anonymous.0aa2d72c-c7a6-496a-9418-5c4647e61611:0: 0x7f23740457f0
2013-10-25 11:34:59 [Broker] debug anonymous.0aa2d72c-c7a6-496a-9418-5c4647e61611:0: detached on broker.
^C
$
  • The above logging prints out session attachment event (QPID_LOG macro called in SessionState constructor) and session detaching event. But the logging lacks any other log, despite of critical verbosity. To print out also default logging, let add --log-enable=notice+:
$ qpidd --log-enable=debug+:SessionState::SessionState --log-enable=debug+:SessionState::detach --log-enable=notice+
2013-10-25 11:35:26 [Broker] notice SASL disabled: No Authentication Performed
2013-10-25 11:35:26 [Network] notice Listening on TCP/TCP6 port 5672
2013-10-25 11:35:26 [Security] notice SSL plugin not enabled, you must set --ssl-cert-db to enable it.
2013-10-25 11:35:26 [Broker] notice Broker running
2013-10-25 11:35:29 [Broker] debug SessionState::SessionState anonymous.fabe325f-d613-4320-9d11-6503e95a278d:0: 0x7f78f0004a90
2013-10-25 11:35:29 [Broker] debug anonymous.fabe325f-d613-4320-9d11-6503e95a278d:0: detached on broker.
^C2013-10-25 11:35:31 [Broker] notice Shut down
$
  • To see all logs related to a connection, let use:
$ qpidd --log-enable=trace+:Connection --log-enable=notice+2013-10-25 11:38:29 [Broker] notice SASL disabled: No Authentication Performed
2013-10-25 11:38:29 [Network] notice Listening on TCP/TCP6 port 5672
2013-10-25 11:38:29 [Security] notice SSL plugin not enabled, you must set --ssl-cert-db to enable it.
2013-10-25 11:38:29 [Broker] notice Broker running
2013-10-25 11:38:32 [Broker] debug LinkRegistry::notifyConnection(); key=127.0.0.1:5672-127.0.0.1:51750
2013-10-25 11:38:32 [Model] trace Mgmt create connection. id:127.0.0.1:5672-127.0.0.1:51750
2013-10-25 11:38:32 [Protocol] trace SENT [127.0.0.1:5672-127.0.0.1:51750]: INIT(0-10)
..
2013-10-25 11:38:32 [Model] debug Delete connection. user:anonymous rhost:127.0.0.1:5672-127.0.0.1:51750
2013-10-25 11:38:39 [Model] trace Mgmt delete connection. id:127.0.0.1:5672-127.0.0.1:51750 Statistics: {bytesFromClient:1128, bytesToClient:2327, closing:False, framesFromClient:18, framesToClient:17, msgsFromClient:1, msgsToClient:1}
^C2013-10-25 11:38:44 [Broker] notice Shut down
$
  • See the excessive number of log records just after enabling trace logs from one area.
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.