qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1691029 - in /qpid/java/trunk: broker-core/src/main/java/org/apache/qpid/server/logging/ broker-plugins/management-http/src/main/java/resources/js/qpid/management/ broker-plugins/management-http/src/main/java/resources/js/qpid/management/l...
Date Tue, 14 Jul 2015 16:23:24 GMT
Author: kwall
Date: Tue Jul 14 16:23:24 2015
New Revision: 1691029

URL: http://svn.apache.org/r1691029
Log:
QPID-6643: [Java Broker] Enhance the broker console logger to have the ability to log to stderr
in addition to stdout.

Work done by Lorenz Quack <quack.lorenz@gmail.com> and Keith Wall.

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLogger.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLoggerImpl.java
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addLogger.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/brokerlogger/console/add.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/loggerfilter/virtualhostloggerfilter/nameandlevel/add.js
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/add.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/show.html
    qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/file/add.html

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLogger.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLogger.java?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLogger.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLogger.java
Tue Jul 14 16:23:24 2015
@@ -31,4 +31,13 @@ public interface BrokerConsoleLogger<X e
 
     @ManagedAttribute(defaultValue = "%date %-5level [%thread] \\(%logger{2}\\) - %msg%n")
     String getLayout();
+
+    @ManagedAttribute(defaultValue = "STDOUT", validValues = {"org.apache.qpid.server.logging.BrokerConsoleLoggerImpl#getAllConsoleStreamTarget()"})
+    ConsoleStreamTarget getConsoleStreamTarget();
+
+    enum ConsoleStreamTarget
+    {
+        STDOUT,
+        STDERR
+    }
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLoggerImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLoggerImpl.java?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLoggerImpl.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/BrokerConsoleLoggerImpl.java
Tue Jul 14 16:23:24 2015
@@ -20,9 +20,12 @@
  */
 package org.apache.qpid.server.logging;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.List;
 import java.util.Map;
 
-import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.core.Appender;
@@ -38,6 +41,9 @@ public class BrokerConsoleLoggerImpl ext
     @ManagedAttributeField
     private String _layout;
 
+    @ManagedAttributeField
+    private ConsoleStreamTarget _consoleStreamTarget;
+
     @ManagedObjectFactoryConstructor
     protected BrokerConsoleLoggerImpl(final Map<String, Object> attributes, Broker<?>
broker)
     {
@@ -45,6 +51,12 @@ public class BrokerConsoleLoggerImpl ext
     }
 
     @Override
+    public ConsoleStreamTarget getConsoleStreamTarget()
+    {
+        return _consoleStreamTarget;
+    }
+
+    @Override
     public String getLayout()
     {
         return _layout;
@@ -60,9 +72,24 @@ public class BrokerConsoleLoggerImpl ext
         encoder.setContext(context);
         encoder.start();
 
+        if (_consoleStreamTarget == ConsoleStreamTarget.STDERR)
+        {
+            consoleAppender.setTarget("System.err");
+        }
         consoleAppender.setEncoder(encoder);
 
         return consoleAppender;
     }
 
+    @SuppressWarnings("unused")
+    public static Collection<String> getAllConsoleStreamTarget()
+    {
+        List<String> validValues = new ArrayList<>();
+        for (ConsoleStreamTarget level : EnumSet.allOf(ConsoleStreamTarget.class))
+        {
+            validValues.add(level.name());
+        }
+        return validValues;
+    }
+
 }

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addLogger.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addLogger.js?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addLogger.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addLogger.js
Tue Jul 14 16:23:24 2015
@@ -159,7 +159,11 @@ define(["dojo/_base/lang",
                      {
                          try
                          {
-                             var promise = typeUI.show({ containerNode:that.typeFieldsContainer,
data: that.initialData });
+                             var promise = typeUI.show({ containerNode: that.typeFieldsContainer,
+                                                         data: that.initialData,
+                                                         metadata: that.management.metadata,
+                                                         category: that.category,
+                                                         type: type});
                              if (promise)
                              {
                                  promise.then(

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/brokerlogger/console/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/brokerlogger/console/add.js?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/brokerlogger/console/add.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logger/brokerlogger/console/add.js
Tue Jul 14 16:23:24 2015
@@ -31,8 +31,17 @@ define(["dojo/dom",
     return {
       show: function(data)
       {
+        var that = this;
+        this.metadata = data.metadata;
+        this.containerNode = data.containerNode;
         data.containerNode.innerHTML = template;
-        return parser.parse(data.containerNode);
+        return parser.parse(data.containerNode).then(function(instances)
+        {
+          var consoleStreamTargetWidget = registry.byId("addLogger.console.consoleStreamTarget");
+          var validValues = that.metadata.getMetaData(data.category, data.type).attributes.consoleStreamTarget.validValues;
+          var validValueStore = util.makeTypeStore(validValues);
+          consoleStreamTargetWidget.set("store", validValueStore);
+        });
       }
     };
   }

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/loggerfilter/virtualhostloggerfilter/nameandlevel/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/loggerfilter/virtualhostloggerfilter/nameandlevel/add.js?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/loggerfilter/virtualhostloggerfilter/nameandlevel/add.js
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/loggerfilter/virtualhostloggerfilter/nameandlevel/add.js
Tue Jul 14 16:23:24 2015
@@ -28,7 +28,7 @@ define(["dojo/dom",
     "dojo/domReady!"],
   function (dom, query, array, registry, util, parser, template)
   {
-    var addFileLogger =
+    var addLoggerFilter =
     {
       show: function(data)
       {
@@ -46,6 +46,6 @@ define(["dojo/dom",
       }
     };
 
-    return addFileLogger;
+    return addLoggerFilter;
   }
 );

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/add.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/add.html?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/add.html
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/add.html
Tue Jul 14 16:23:24 2015
@@ -19,6 +19,19 @@
 
 <div>
     <div class="clear">
+        <div class="formLabel-labelCell tableContainer-labelCell">Console Stream Target:</div>
+        <div class="tableContainer-valueCell formLabel-controlCell">
+            <select id="addLogger.console.consoleStreamTarget" data-dojo-type="dijit/form/FilteringSelect"
+                    data-dojo-props="
+                                name: 'consoleStreamTarget',
+                                required: true,
+                                placeHolder: 'select console stream target',
+                                promptMessage: 'Where the console stream will go',
+                                title: 'Select target'">
+            </select>
+        </div>
+    </div>
+    <div class="clear">
         <div class="formLabel-labelCell tableContainer-labelCell">Log Message Format:</div>
         <div class="formLabel-controlCell tableContainer-valueCell">
             <input type="text" id="addLogger.console.layout"
@@ -26,8 +39,8 @@
                    data-dojo-props="
                               name: 'layout',
                               placeHolder: '%d %-5p [%t] \(%c{2}\) - %m%n',
-                              promptMessage: 'Enter the format of the log messages using
logback formating',
-                              title: 'Enter the format of the log messages using logback
formating'"/>
+                              promptMessage: 'Enter the format of the log messages using
logback formatting',
+                              title: 'Enter the format of the log messages using logback
formatting'"/>
         </div>
     </div>
 </div>

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/show.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/show.html?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/show.html
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/console/show.html
Tue Jul 14 16:23:24 2015
@@ -20,6 +20,10 @@
  -->
 <div>
     <div class="clear">
+      <div class="formLabel-labelCell">Console Stream Target:</div>
+      <div class="consoleStreamTarget"></div>
+    </div>
+    <div class="clear">
         <div class="formLabel-labelCell">Log Message Format:</div>
         <div class="layout"></div>
     </div>

Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/file/add.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/file/add.html?rev=1691029&r1=1691028&r2=1691029&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/file/add.html
(original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/logger/file/add.html
Tue Jul 14 16:23:24 2015
@@ -26,8 +26,8 @@
                    data-dojo-props="
                               name: 'layout',
                               placeHolder: '%d %-5p [%t] \(%c{2}\) - %m%n',
-                              promptMessage: 'Enter the format of the log messages using
logback formating',
-                              title: 'Enter the format of the log messages using logback
formating'"/>
+                              promptMessage: 'Enter the format of the log messages using
logback formatting',
+                              title: 'Enter the format of the log messages using logback
formatting'"/>
         </div>
     </div>
     <div class="clear">



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


Mime
View raw message