logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject svn commit: r1563911 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/ log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ src/site/resources/...
Date Mon, 03 Feb 2014 14:29:15 GMT
Author: rpopma
Date: Mon Feb  3 14:29:15 2014
New Revision: 1563911

URL: http://svn.apache.org/r1563911
Log:
LOG4J2-500 Further JMX improvements, incl updated screenshots

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AppenderAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AsyncAppenderAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ContextSelectorAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerConfigAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerContextAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/StatusLoggerAdminMBean.java
    logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
    logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java
    logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-editconfig.png
    logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-mbeans.png
    logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-statuslogger.png
    logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-editconfig.png
    logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-statuslogger.png

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
Mon Feb  3 14:29:15 2014
@@ -217,7 +217,7 @@ public class LoggerContext implements or
             configLock.unlock();
             
             // in finally: unregister MBeans even if an exception occurred while stopping

-            Server.unregisterMBeans(); // LOG4J2-406
+            Server.unregisterLoggerContext(getName()); // LOG4J2-406, LOG4J2-500
         }
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AppenderAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AppenderAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AppenderAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AppenderAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -46,7 +46,7 @@ public interface AppenderAdminMBean {
      * </pre>
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=Appender,name=%s";
+    String PATTERN = Server.DOMAIN + ":type=%s,component=Appenders,name=%s";
 
     /**
      * Returns the name of the instrumented {@code Appender}.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AsyncAppenderAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AsyncAppenderAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AsyncAppenderAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/AsyncAppenderAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -48,7 +48,7 @@ public interface AsyncAppenderAdminMBean
      * 
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=AsyncAppender,name=%s";
+    String PATTERN = Server.DOMAIN + ":type=%s,component=AsyncAppenders,name=%s";
 
     /**
      * Returns the name of the instrumented {@code AsyncAppender}.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ContextSelectorAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ContextSelectorAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ContextSelectorAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/ContextSelectorAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -43,7 +43,7 @@ public interface ContextSelectorAdminMBe
      * </pre>
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=ContextSelector";
+    String PATTERN = Server.DOMAIN + ":type=%s,component=ContextSelector";
 
     /**
      * Returns the name of the class implementing the {@code ContextSelector}

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerConfigAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerConfigAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerConfigAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerConfigAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -45,7 +45,7 @@ public interface LoggerConfigAdminMBean 
      * </pre>
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=LoggerConfig,name=%s";
+    String PATTERN = Server.DOMAIN + ":type=%s,component=Loggers,name=%s";
 
     /**
      * Returns the name of the instrumented {@code LoggerConfig}.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerContextAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerContextAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerContextAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/LoggerContextAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -47,7 +47,7 @@ public interface LoggerContextAdminMBean
      * </pre>
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s";
+    String PATTERN = Server.DOMAIN + ":type=%s";
 
     /**
      * Notification that the {@code Configuration} of the instrumented

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/RingBufferAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -34,7 +34,7 @@ public interface RingBufferAdminMBean {
      * Set&lt;ObjectName&gt; asyncLoggerNames = mbs.queryNames(new ObjectName(pattern),
null);
      * </pre>
      */
-    String PATTERN_ASYNC_LOGGER = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,name=AsyncLoggerRingBuffer";
+    String PATTERN_ASYNC_LOGGER = Server.DOMAIN + ":type=%s,component=AsyncLoggerRingBuffer";
     
     /**
      * ObjectName pattern ({@value}) for RingBufferAdmin MBeans that instrument
@@ -50,7 +50,7 @@ public interface RingBufferAdminMBean {
      * Set&lt;ObjectName&gt; asyncConfigNames = mbs.queryNames(new ObjectName(pattern),
null);
      * </pre>
      */
-    String PATTERN_ASYNC_LOGGER_CONFIG = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=LoggerConfig,name=%s,subtype=RingBuffer";
+    String PATTERN_ASYNC_LOGGER_CONFIG = Server.DOMAIN + ":type=%s,component=Loggers,name=%s,subtype=RingBuffer";
 
     /**
      * Returns the number of slots that the ring buffer was configured with.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
Mon Feb  3 14:29:15 2014
@@ -50,6 +50,11 @@ import org.apache.logging.log4j.status.S
  */
 public final class Server {
 
+    /**
+     * The domain part, or prefix ({@value} ) of the {@code ObjectName} of all
+     * MBeans that instrument Log4J2 components.
+     */
+    public static final String DOMAIN = "org.apache.logging.log4j2";
     private static final String PROPERTY_DISABLE_JMX = "log4j2.disable.jmx";
     private static final StatusLogger LOGGER = StatusLogger.getLogger();
     static final Executor executor = Executors.newFixedThreadPool(1);
@@ -120,12 +125,6 @@ public final class Server {
             return;
         }
 
-        // first unregister the old MBeans
-        // TODO is this too drastic? This may impact the MBean of other
-        // webapps...
-        // but below we will only re-register the MBeans of OUR context selector
-        unregisterMBeans(mbs);
-
         // now provide instrumentation for the newly configured
         // LoggerConfigs and Appenders
         try {
@@ -138,7 +137,7 @@ public final class Server {
             for (LoggerContext ctx : contexts) {
                 // first unregister the context and all nested loggers,
                 // appenders, statusLogger, contextSelector, ringbuffers...
-                unregisterAll(ctx.getName(), mbs);
+                unregisterLoggerContext(ctx.getName(), mbs);
 
                 final LoggerContextAdmin mbean = new LoggerContextAdmin(ctx, executor);
                 register(mbs, mbean, mbean.getObjectName());
@@ -211,9 +210,9 @@ public final class Server {
      * 
      * @param loggerContextName name of the logger context to unregister
      */
-    public static void unregisterAll(String loggerContextName) {
+    public static void unregisterLoggerContext(String loggerContextName) {
         final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        unregisterAll(loggerContextName, mbs);
+        unregisterLoggerContext(loggerContextName, mbs);
     }
 
     /**
@@ -224,7 +223,7 @@ public final class Server {
      * @param loggerContextName name of the logger context to unregister
      * @param mbs the MBean Server to unregister the instrumented objects from
      */
-    public static void unregisterAll(String contextName, MBeanServer mbs) {
+    public static void unregisterLoggerContext(String contextName, MBeanServer mbs) {
         final String pattern = LoggerContextAdminMBean.PATTERN;
         final String search = String.format(pattern, escape(contextName), "*");
         unregisterAllMatching(search, mbs); // unregister context mbean

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/StatusLoggerAdminMBean.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/StatusLoggerAdminMBean.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/StatusLoggerAdminMBean.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/StatusLoggerAdminMBean.java
Mon Feb  3 14:29:15 2014
@@ -49,7 +49,7 @@ public interface StatusLoggerAdminMBean 
      * </pre>
      * @see Server#escape(String)
      */
-    String PATTERN = "org.apache.logging.log4j2:type=LoggerContext,ctx=%s,sub=StatusLogger";
+    String PATTERN = Server.DOMAIN + ":type=%s,component=StatusLogger";
 
     /**
      * Notifications with this type have a {@code StatusData} userData object

Modified: logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
Mon Feb  3 14:29:15 2014
@@ -29,7 +29,6 @@ import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 
 import org.apache.logging.log4j.core.helpers.Assert;
-import org.apache.logging.log4j.core.jmx.ContextSelectorAdminMBean;
 import org.apache.logging.log4j.core.jmx.LoggerContextAdminMBean;
 import org.apache.logging.log4j.core.jmx.Server;
 import org.apache.logging.log4j.core.jmx.StatusLoggerAdminMBean;
@@ -41,10 +40,6 @@ import org.apache.logging.log4j.core.jmx
 public class Client {
     private JMXConnector connector;
     private final MBeanServerConnection connection;
-    private List<StatusLoggerAdminMBean> statusLoggerAdminList;
-    private List<ContextSelectorAdminMBean> contextSelectorAdminList;
-    private List<LoggerContextAdminMBean> contextAdminList;
-
     /**
      * Constructs a new {@code Client} object and creates proxies for all known
      * remote MBeans.
@@ -78,34 +73,6 @@ public class Client {
     }
 
     private void init() throws JMException, IOException {
-        statusLoggerAdminList = new ArrayList<StatusLoggerAdminMBean>();
-        final Set<ObjectName> statusLogNames = find(StatusLoggerAdminMBean.PATTERN);
-        for (final ObjectName statusLogName : statusLogNames) {
-            final StatusLoggerAdminMBean ctx = JMX.newMBeanProxy(connection, //
-                    statusLogName, //
-                    StatusLoggerAdminMBean.class, true); // notificationBroadcaster
-            statusLoggerAdminList.add(ctx);
-        }
-
-        contextSelectorAdminList = new ArrayList<ContextSelectorAdminMBean>();
-        final Set<ObjectName> selectorNames = find(ContextSelectorAdminMBean.PATTERN);
-        for (final ObjectName selectorName : selectorNames) {
-            final ContextSelectorAdminMBean ctx = JMX.newMBeanProxy(connection, //
-                    selectorName, //
-                    ContextSelectorAdminMBean.class, false);
-            contextSelectorAdminList.add(ctx);
-        }
-
-        contextAdminList = new ArrayList<LoggerContextAdminMBean>();
-        final Set<ObjectName> contextNames = find(LoggerContextAdminMBean.PATTERN);
-        for (final ObjectName contextName : contextNames) {
-            final LoggerContextAdminMBean ctx = JMX.newMBeanProxy(connection, //
-                    contextName, //
-                    LoggerContextAdminMBean.class, false);
-            contextAdminList.add(ctx);
-
-            // TODO Appenders, LoggerConfigs
-        }
     }
 
     private Set<ObjectName> find(String pattern) throws JMException, IOException {
@@ -115,24 +82,23 @@ public class Client {
     }
 
     /**
-     * Returns a list of proxies that allows operations to be performed on the
-     * remote {@code ContextSelectorAdminMBean}s.
-     * 
-     * @return a list of proxies to the remote {@code ContextSelectorAdminMBean}
-     *         s
-     */
-    public List<ContextSelectorAdminMBean> getContextSelectorAdminList() {
-        return contextSelectorAdminList;
-    }
-
-    /**
      * Returns a list of proxies that allow operations to be performed on the
      * remote {@code LoggerContextAdminMBean}s.
      * 
      * @return a list of proxies to the remote {@code LoggerContextAdminMBean}s
+     * @throws IOException
+     * @throws JMException
      */
-    public List<LoggerContextAdminMBean> getLoggerContextAdmins() {
-        return new ArrayList<LoggerContextAdminMBean>(contextAdminList);
+    public List<LoggerContextAdminMBean> getLoggerContextAdmins() throws JMException,
IOException {
+        List<LoggerContextAdminMBean> result = new ArrayList<LoggerContextAdminMBean>();
+        final Set<ObjectName> contextNames = find(LoggerContextAdminMBean.PATTERN);
+        for (final ObjectName contextName : contextNames) {
+            final LoggerContextAdminMBean ctx = JMX.newMBeanProxy(connection, //
+                    contextName, //
+                    LoggerContextAdminMBean.class, false);
+            result.add(ctx);
+        }
+        return result;
     }
 
     /**
@@ -158,16 +124,6 @@ public class Client {
     }
 
     /**
-     * Returns a list of proxies that allows operations to be performed on the
-     * remote {@code StatusLoggerAdminMBean}s.
-     * 
-     * @return a list of proxies to the remote {@code StatusLoggerAdminMBean}s
-     */
-    public List<StatusLoggerAdminMBean> getStatusLoggerAdminList() {
-        return statusLoggerAdminList;
-    }
-
-    /**
      * Returns the {@code StatusLoggerAdminMBean} associated with the specified
      * context name, or {@code null}.
      * 

Modified: logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGUI.java
Mon Feb  3 14:29:15 2014
@@ -27,6 +27,9 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+import javax.management.MBeanServerDelegate;
+import javax.management.MBeanServerNotification;
 import javax.management.MalformedObjectNameException;
 import javax.management.Notification;
 import javax.management.NotificationFilterSupport;
@@ -50,6 +53,7 @@ import javax.swing.UIManager.LookAndFeel
 
 import org.apache.logging.log4j.core.helpers.Assert;
 import org.apache.logging.log4j.core.jmx.LoggerContextAdminMBean;
+import org.apache.logging.log4j.core.jmx.Server;
 import org.apache.logging.log4j.core.jmx.StatusLoggerAdminMBean;
 
 /**
@@ -67,10 +71,16 @@ public class ClientGUI extends JPanel im
     private Map<String, JTextArea> statusLogTextAreaMap = new HashMap<String, JTextArea>();
     private JTabbedPane tabbedPaneContexts;
 
-    public ClientGUI(final Client client) throws InstanceNotFoundException, MalformedObjectNameException,
IOException {
+    public ClientGUI(final Client client) throws IOException, JMException {
         this.client = Assert.isNotNull(client, "client");
         createWidgets();
         populateWidgets();
+
+        // register for Notifications if LoggerContext MBean was added/removed
+        ObjectName addRemoveNotifs = MBeanServerDelegate.DELEGATE_NAME;
+        NotificationFilterSupport filter = new NotificationFilterSupport();
+        filter.enableType(Server.DOMAIN); // only interested in Log4J2 MBeans
+        client.getConnection().addNotificationListener(addRemoveNotifs, this, filter, null);
     }
 
     private void createWidgets() {
@@ -79,7 +89,7 @@ public class ClientGUI extends JPanel im
         this.add(tabbedPaneContexts, BorderLayout.CENTER);
     }
 
-    private void populateWidgets() throws MalformedObjectNameException, IOException, InstanceNotFoundException
{
+    private void populateWidgets() throws IOException, JMException {
 
         for (final LoggerContextAdminMBean ctx : client.getLoggerContextAdmins()) {
             JTabbedPane contextTabs = new JTabbedPane();
@@ -138,8 +148,7 @@ public class ClientGUI extends JPanel im
         final NotificationFilterSupport filter = new NotificationFilterSupport();
         filter.enableType(StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE);
         final ObjectName objName = status.getObjectName();
-        client.getConnection().addNotificationListener(objName, this, filter,
-                status.getContextName());
+        client.getConnection().addNotificationListener(objName, this, filter, status.getContextName());
     }
 
     @Override
@@ -149,10 +158,34 @@ public class ClientGUI extends JPanel im
             if (text != null) {
                 text.append(notif.getMessage() + "\n");
             }
+            return;
+        }
+        if (notif instanceof MBeanServerNotification) {
+            MBeanServerNotification mbsn = (MBeanServerNotification) notif;
+            ObjectName mbeanName = mbsn.getMBeanName();
+            if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notif.getType()))
{
+                onMBeanRegistered(mbeanName);
+            } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notif.getType()))
{
+                onMBeanUnregistered(mbeanName);
+            }
         }
     }
 
     /**
+     * @param mbeanName
+     */
+    private void onMBeanRegistered(ObjectName mbeanName) {
+        // TODO update widgets if logger context was added
+    }
+
+    /**
+     * @param mbeanName
+     */
+    private void onMBeanUnregistered(ObjectName mbeanName) {
+        // TODO update widgets if logger context was removed
+    }
+
+    /**
      * Connects to the specified location and shows this panel in a window.
      * <p>
      * Useful links:

Modified: logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-editconfig.png
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-editconfig.png?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
Binary files - no diff available.

Modified: logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-mbeans.png
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-mbeans.png?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
Binary files - no diff available.

Modified: logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-statuslogger.png
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/resources/images/jmx-jconsole-statuslogger.png?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
Binary files - no diff available.

Modified: logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-editconfig.png
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-editconfig.png?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
Binary files - no diff available.

Modified: logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-statuslogger.png
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/resources/images/jmx-standalone-statuslogger.png?rev=1563911&r1=1563910&r2=1563911&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message