On 12/22/2010 10:22 PM, [email protected] wrote:
Author: jonathan
Date: Wed Dec 22 22:22:13 2010
New Revision: 1052086

URL: http://svn.apache.org/viewvc?rev=1052086&view=rev
Log:
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.

What is the usual default for the log level (i.e. what is the default for other uses of the log module)? It seems a little odd to set the log level to error on most tools, perhaps that's just me...

qpid-printevents allows the log level to be set.

What about the other tools? Is it not useful for them to also be able to set the logging level? (As the topic of consistency came up recently, should the -v/--verbose option in qpid-route by rationalised with this?)

It also allows the user to specify that a connection is required, in which case 
it terminates if a connection can not be established.

I'm not mad on the name of this new option (i.e. require-connection). It
seems like allow-reconnect or exit-on-failure would communicate a little
more on the purpose of the option.

Modified: qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py?rev=1052086&r1=1052085&r2=1052086&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py Wed Dec 22 22:22:13 2010
@@ -39,8 +39,8 @@ from Queue           import Queue, Empty
  from time            import time, strftime, gmtime, sleep
  from cStringIO       import StringIO

-#import qpid.log
-#qpid.log.enable(name="qpid.io.cmd", level=qpid.log.DEBUG)
+import qpid.log
+qpid.log.enable(name="qpid.qmf")

  
#===================================================================================================
  # CONSOLE
@@ -2509,6 +2509,14 @@ class Broker(Thread):

      except Exception, e:
        self.error = "Exception during connection setup: %s - %s" % 
(e.__class__.__name__, e)
+
+      log = qpid.log.getLogger("qpid.qmf")
+
+      if e[0] == -2:
+          log.warning("Could not connect to broker " + self.host + ":" + str(self.port) 
+ " " + str(e))
+      else:
+          log.error("Could not connect to broker " + self.host + ":" + str(self.port) + 
" " + str(e))
+

What's the above if/else actually checking? Is there a way to make the code more obvious to a casual reader?

        self.conn_exc = e
        return False     # connection failed



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to