tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject tomee git commit: Test the slf4j reset method on undeploy
Date Thu, 10 Sep 2015 21:43:13 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 7cbbe78cd -> 9c4728b14


Test the slf4j reset method on undeploy

system.properties : org.apache.tomee.slf4j.deployment.reset = true


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/9c4728b1
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/9c4728b1
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/9c4728b1

Branch: refs/heads/tomee-1.7.x
Commit: 9c4728b14e3f9bde034852e046d81dcf2bc800ed
Parents: 7cbbe78
Author: AndyGee <andy.is@gmx.de>
Authored: Thu Sep 10 23:42:45 2015 +0200
Committer: AndyGee <andy.is@gmx.de>
Committed: Thu Sep 10 23:42:45 2015 +0200

----------------------------------------------------------------------
 .../openejb/assembler/classic/Assembler.java    | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/9c4728b1/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index ce29b2a..0db8110 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -197,6 +197,7 @@ import java.io.Serializable;
 import java.lang.instrument.ClassFileTransformer;
 import java.lang.instrument.Instrumentation;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
@@ -2120,12 +2121,33 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
                 throw undeployException;
             }
 
+            this.resetSlf4j();
+
             logger.debug("destroyApplication.success", appInfo.path);
         } finally {
             l.unlock();
         }
     }
 
+    private void resetSlf4j() {
+        if (SystemInstance.get().getOptions().get("org.apache.tomee.slf4j.deployment.reset",
false)) {
+            try {
+                final Class<?> c = Class.forName("org.slf4j.LoggerFactory");
+                final Method m = c.getDeclaredMethod("reset", null);
+                m.setAccessible(true);
+                m.invoke(null);
+            } catch (final ClassNotFoundException e) {
+                e.printStackTrace();
+            } catch (final NoSuchMethodException e) {
+                e.printStackTrace();
+            } catch (final InvocationTargetException e) {
+                e.printStackTrace();
+            } catch (final IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
     private void destroyLookedUpResource(final Context globalContext, final String id, final
String name) throws NamingException {
         final Object object = globalContext.lookup(name);
         final String clazz;


Mime
View raw message