You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2011/02/09 07:36:07 UTC

svn commit: r1068761 - /geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java

Author: gawor
Date: Wed Feb  9 06:36:06 2011
New Revision: 1068761

URL: http://svn.apache.org/viewvc?rev=1068761&view=rev
Log:
remove listener once the bundle is stopped

Modified:
    geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java

Modified: geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java?rev=1068761&r1=1068760&r2=1068761&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java (original)
+++ geronimo/server/branches/3.0-M2/framework/modules/geronimo-pax-logging/src/main/java/org/apache/geronimo/logging/impl/LoggingServiceActivator.java Wed Feb  9 06:36:06 2011
@@ -39,6 +39,7 @@ public class LoggingServiceActivator imp
 
     private Activator activator;
     private Log4jService service;
+    private PropertyChangeListener logManagerChangeListener;
     
     public LoggingServiceActivator() {
         activator = new Activator();       
@@ -66,7 +67,7 @@ public class LoggingServiceActivator imp
             final LogManager manager = LogManager.getLogManager();
             final Handler[] paxHandlers = manager.getLogger("").getHandlers();
 
-            manager.addPropertyChangeListener(new PropertyChangeListener() {
+            logManagerChangeListener = (new PropertyChangeListener() {
                 public void propertyChange(PropertyChangeEvent evt) {
                     Logger rootLogger = manager.getLogger("");
                     Handler[] handlers = rootLogger.getHandlers();
@@ -79,6 +80,8 @@ public class LoggingServiceActivator imp
                     rootLogger.warning("java.util.logging has been reset by application or component");
                 }
             });
+            
+            manager.addPropertyChangeListener(logManagerChangeListener);
         }
     }
 
@@ -91,7 +94,10 @@ public class LoggingServiceActivator imp
         if (service != null) {
             service.stop();
         }    
-        activator.stop(context);       
+        activator.stop(context);     
+        if (logManagerChangeListener != null) {
+            LogManager.getLogManager().removePropertyChangeListener(logManagerChangeListener);
+        }
     }
    
 }