Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix call to SimpleLoggerFactory.reset method #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,5 @@ public void activate()
// 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...
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* 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.
Expand All @@ -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();
}
}
}