Menu Search

1.15. Logging

To simplify debugging, Qpid provides a logging facility that prints out messaging events.

1.15.1. Logging in C++

The Qpidd broker and C++ clients can both use environment variables to enable logging. Linux and Windows systems use the same named environment variables and values.

Use QPID_LOG_ENABLE to set the level of logging you are interested in (trace, debug, info, notice, warning, error, or critical):

	  export QPID_LOG_ENABLE="warning+"
	

The Qpidd broker and C++ clients use QPID_LOG_OUTPUT to determine where logging output should be sent. This is either a file name or the special values stderr, stdout, or syslog:

	  export QPID_LOG_TO_FILE="/tmp/myclient.out"
	

From a Windows command prompt, use the following command format to set the environment variables:

	  set QPID_LOG_ENABLE=warning+
	  set QPID_LOG_TO_FILE=D:\tmp\myclient.out
	

1.15.2. Logging in Python

The Python client library supports logging using the standard Python logging module. The easiest way to do logging is to use the basicConfig(), which reports all warnings and errors:

from logging import basicConfig
	basicConfig()
	

Qpidd also provides a convenience method that makes it easy to specify the level of logging desired. For instance, the following code enables logging at the DEBUG level:

from qpid.log import enable, DEBUG
	enable("qpid.messaging.io", DEBUG)
	

For more information on Python logging, see http://docs.python.org/lib/node425.html. For more information on Qpid logging, use $ pydoc qpid.log.