mirror of https://github.com/apache/maven.git
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>
This commit is contained in:
parent
2ec0a6b69f
commit
8b97b0a2da
|
@ -58,20 +58,5 @@ public void activate()
|
||||||
// property for root logger level or System.out redirection need to be taken into account
|
// property for root logger level or System.out redirection need to be taken into account
|
||||||
MavenSlf4jFriend.reset();
|
MavenSlf4jFriend.reset();
|
||||||
MavenSlf4jSimpleFriend.init();
|
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...
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.slf4j.ILoggerFactory;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility for Maven to access Slf4j-Simple internals through package access.
|
* Utility for Maven to access Slf4j-Simple internals through package access.
|
||||||
* Use with precaution, since this is not normally intended for production use.
|
* Use with precaution, since this is not normally intended for production use.
|
||||||
|
@ -28,6 +31,10 @@ public class MavenSlf4jSimpleFriend
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
SimpleLogger.init();
|
SimpleLogger.init();
|
||||||
SimpleLoggerFactory.INSTANCE.reset();
|
ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
|
||||||
|
if ( loggerFactory instanceof SimpleLoggerFactory )
|
||||||
|
{
|
||||||
|
( (SimpleLoggerFactory) loggerFactory ).reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue