maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject git commit: Fix call to SimpleLoggerFactory.reset method (use LoggerFactory to make sure we get the right instance to reset, as SimpleLoggerFactory.INSTANCE is not actually used by slf4j-simple's StaticLoggerBinder) and remove temporary reflection workar
Date Mon, 18 Mar 2013 19:13:36 GMT
Updated Branches:
  refs/heads/master 2ec0a6b69 -> 8b97b0a2d


Fix call to SimpleLoggerFactory.reset method (use LoggerFactory to make sure we get the right
instance to reset, as SimpleLoggerFactory.INSTANCE is not actually used by slf4j-simple's
StaticLoggerBinder) and remove temporary reflection workaround

Signed-off-by: Jason van Zyl <jason@tesla.io>


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/8b97b0a2
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8b97b0a2
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8b97b0a2

Branch: refs/heads/master
Commit: 8b97b0a2dae4ab8b8b5cc614ca58b329af2ce6ff
Parents: 2ec0a6b
Author: Stuart McCulloch <mcculls@gmail.com>
Authored: Mon Mar 18 18:57:04 2013 +0000
Committer: Jason van Zyl <jason@tesla.io>
Committed: Mon Mar 18 12:12:22 2013 -0700

----------------------------------------------------------------------
 .../cli/logging/impl/Slf4jSimpleConfiguration.java |   15 ---------------
 .../org/slf4j/impl/MavenSlf4jSimpleFriend.java     |    9 ++++++++-
 2 files changed, 8 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/8b97b0a2/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java
b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java
index 402d562..6a7f385 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java
@@ -58,20 +58,5 @@ public class Slf4jSimpleConfiguration
         // property for root logger level or System.out redirection need to be taken into
account
         MavenSlf4jFriend.reset();
         MavenSlf4jSimpleFriend.init();
-        
-        try
-        {
-             org.slf4j.ILoggerFactory loggerFactory = org.slf4j.LoggerFactory.getILoggerFactory();
-             synchronized ( loggerFactory )
-             {
-                 java.lang.reflect.Field loggerMap = loggerFactory.getClass().getDeclaredField(
"loggerMap" );
-                 loggerMap.setAccessible( true );
-                 ( (java.util.Map) loggerMap.get( loggerFactory ) ).clear();
-             }
-        }
-        catch ( Exception e )
-        {
-            // ignore for now...
-        }        
     }
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/8b97b0a2/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
index 3299fc8..bffd18c 100644
--- a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
+++ b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
@@ -19,6 +19,9 @@ package org.slf4j.impl;
  * under the License.
  */
 
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+
 /**
  * Utility for Maven to access Slf4j-Simple internals through package access.
  * Use with precaution, since this is not normally intended for production use.
@@ -28,6 +31,10 @@ public class MavenSlf4jSimpleFriend
     public static void init()
     {
         SimpleLogger.init();
-        SimpleLoggerFactory.INSTANCE.reset();
+        ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
+        if ( loggerFactory instanceof SimpleLoggerFactory )
+        {
+            ( (SimpleLoggerFactory) loggerFactory ).reset();
+        }
     }
 }


Mime
View raw message