qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1676333 - in /qpid/trunk/qpid: cpp/src/qpid/log/Logger.cpp tools/src/py/qpid-config tools/src/py/qpidtoollibs/broker.py
Date Mon, 27 Apr 2015 16:52:28 GMT
Author: aconway
Date: Mon Apr 27 16:52:27 2015
New Revision: 1676333

URL: http://svn.apache.org/r1676333
Log:
NO-JIRA: Add log command to qpid-config to set log levels.

Get current level: qpid-config log
Set new level:     qpid-config log <newlevel>

Fixed bugs in getLogLevel and in handling invalid log levels.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp
    qpid/trunk/qpid/tools/src/py/qpid-config
    qpid/trunk/qpid/tools/src/py/qpidtoollibs/broker.py

Modified: qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp?rev=1676333&r1=1676332&r2=1676333&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/log/Logger.cpp Mon Apr 27 16:52:27 2015
@@ -160,21 +160,23 @@ void Logger::add(Statement& s) {
 }
 
 void Logger::configure(const Options& opts) {
-    options = opts;
     clear();
     Options o(opts);
     if (o.trace)
         o.selectors.push_back("trace+");
     format(o);
     select(Selector(o));
+    options = opts;
     setPrefix(opts.prefix);
     options.sinkOptions->setup(this);
 }
 
 void Logger::reconfigure(const std::vector<std::string>& selectors) {
-    options.selectors = selectors;
-    options.deselectors.clear();
-    select(Selector(options));
+    Options o(options);
+    o.selectors = selectors;
+    o.deselectors.clear();
+    select(Selector(o));
+    options = o;                // Don't update options till selectors has been validated.
 }
 
 void Logger::setPrefix(const std::string& p) { prefix = p; }

Modified: qpid/trunk/qpid/tools/src/py/qpid-config
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-config?rev=1676333&r1=1676332&r2=1676333&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-config (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-config Mon Apr 27 16:52:27 2015
@@ -48,6 +48,7 @@ Usage:  qpid-config [OPTIONS]
         qpid-config [OPTIONS] add <type> <name> [--argument <property-name>=<property-value>]
         qpid-config [OPTIONS] del <type> <name>
         qpid-config [OPTIONS] list <type> [--show-property <property-name>]
+        qpid-config [OPTIONS] log [<logstring>]
         qpid-config [OPTIONS] shutdown"""
 
 description = """
@@ -78,6 +79,10 @@ Replication levels:
     none           - no replication
     configuration  - replicate queue and exchange existence and bindings, but not messages.
     all            - replicate configuration and messages
+
+Log <logstring> value:
+
+    Comma separated <module>:<level> pairs, e.g. 'info+,debug+:Broker,trace+:Queue'
 """
 
 REPLICATE_LEVELS= ["none", "configuration", "all"]
@@ -824,6 +829,10 @@ def main(argv=None):
                 headers = [Header(a) for a in desired]
                 rows = [tuple([_clean_ref(o.get(a, "n/a")) for a in desired]) for o in objects]
                 display.formattedTable("Objects of type '%s'" % modifier, headers, rows)
+            elif cmd == "log" and len (args) == 1:
+                print "Log level:", bm.broker.getLogLevel()["level"]
+            elif cmd == "log" and len (args) == 2:
+                bm.broker.setLogLevel(args[1])
             elif cmd == "shutdown":
                 try:
                     bm.broker._method("shutdown", {})

Modified: qpid/trunk/qpid/tools/src/py/qpidtoollibs/broker.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpidtoollibs/broker.py?rev=1676333&r1=1676332&r2=1676333&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpidtoollibs/broker.py (original)
+++ qpid/trunk/qpid/tools/src/py/qpidtoollibs/broker.py Mon Apr 27 16:52:27 2015
@@ -47,7 +47,7 @@ class BrokerAgent(object):
     """
     self.sess.close()
 
-  def _method(self, method, arguments, addr="org.apache.qpid.broker:broker:amqp-broker",
timeout=10):
+  def _method(self, method, arguments=None, addr="org.apache.qpid.broker:broker:amqp-broker",
timeout=10):
     props = {'method'             : 'request',
              'qmf.opcode'         : '_method_request',
              'x-amqp-0-10.app-id' : 'qmf2'}
@@ -56,7 +56,7 @@ class BrokerAgent(object):
 
     content = {'_object_id'   : {'_object_name' : addr},
                '_method_name' : method,
-               '_arguments'   : arguments}
+               '_arguments'   : arguments or {}}
 
     message = self.message_class(
       content, reply_to=self.reply_to, correlation_id=correlator,



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message