summaryrefslogtreecommitdiff
path: root/qpid/tools/src/py/qpid-tool
diff options
context:
space:
mode:
authorJonathan Robie <jonathan@apache.org>2010-12-22 22:22:13 +0000
committerJonathan Robie <jonathan@apache.org>2010-12-22 22:22:13 +0000
commitf9a0fec8230a3b1f48ff57483c3639d937336114 (patch)
treeb1f19281bae1c9953075d31bec830feef7e8e323 /qpid/tools/src/py/qpid-tool
parent0836e38953b8a1b6c0dc1a8899874b094d6115b6 (diff)
downloadqpid-python-f9a0fec8230a3b1f48ff57483c3639d937336114.tar.gz
Added logging to QMF console connections.
Warning if a broker can not be found, error if SASL authentication fails or other connection errors when connecting to an existing broker. Default log level is ERROR. qpid-printevents allows the log level to be set. It also allows the user to specify that a connection is required, in which case it terminates if a connection can not be established. Examples: $ ./qpid-printevents --sasl-mechanism PLAIN nonexistent-broker => Not an error. Waits for the broker to be started. $ ./qpid-printevents --sasl-mechanism PLAIN localhost 2010-12-22 17:07:18,365 ERROR Could not connect to broker localhost:5672 (None, 'No acceptable SASL authentication mechanism available') => Connection error condition in output - SASL authentication failed because user name and password are not supplied. But qpid-printevents keeps running, waiting for you to start the broker. $ ./qpid-printevents --sasl-mechanism PLAIN --log-level critical => Connection error condition in output - SASL authentication failed because user name and password are not supplied. No output in this case, because the log level has been set to critical. $ ./qpid-printevents --sasl-mechanism PLAIN --require-connection localhost 2010-12-22 17:11:03,791 ERROR Could not connect to broker localhost:5672 (None, 'No acceptable SASL authentication mechanism available') Failed: ConnectionFailed - (None, 'No acceptable SASL authentication mechanism available') => Connection error condition. qpid-printevents terminates because --require-connection was specified. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1052086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/tools/src/py/qpid-tool')
-rwxr-xr-xqpid/tools/src/py/qpid-tool4
1 files changed, 4 insertions, 0 deletions
diff --git a/qpid/tools/src/py/qpid-tool b/qpid/tools/src/py/qpid-tool
index e7c0231b96..e5f5657dff 100755
--- a/qpid/tools/src/py/qpid-tool
+++ b/qpid/tools/src/py/qpid-tool
@@ -30,6 +30,7 @@ from time import strftime, gmtime
from qpid.disp import Display
from qpid.peer import Closed
from qmf.console import Session, Console, SchemaClass, ObjectId
+import qpid.log
class Mcli(Cmd):
""" Management Command Interpreter """
@@ -677,6 +678,8 @@ def Usage():
# Main Program
#=========================================================
+qpid.log.getLogger("qpid.qmf").setLevel(qpid.log.ERROR)
+
# Get host name and port if specified on the command line
cargs = sys.argv[1:]
_host = "localhost"
@@ -692,6 +695,7 @@ if _host[0] == '-':
disp = Display()
+
# Attempt to make a connection to the target broker
try:
data = QmfData(disp, _host)