Author: rpopma
Date: Wed May 1 16:22:05 2013
New Revision: 1478075
URL: http://svn.apache.org/r1478075
Log:
fix for LOG4J2-230, moved check to SLF4JLoggerContextFactory, credited original
reporter of issue 204
Modified:
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
logging/log4j/log4j2/trunk/src/changes/changes.xml
Modified:
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java?rev=1478075&r1=1478074&r2=1478075&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
Wed May 1 16:22:05 2013
@@ -30,17 +30,6 @@ import java.util.concurrent.ConcurrentMa
public class SLF4JLoggerContext implements LoggerContext {
private final ConcurrentMap<String, SLF4JLogger> loggers = new
ConcurrentHashMap<String, SLF4JLogger>();
- public SLF4JLoggerContext() {
- // LOG4J2-230, LOG4J2-204 (improve error reporting when misconfigured)
- try {
- Class.forName("org.slf4j.helpers.Log4JLoggerFactory");
- throw new IllegalStateException("slf4j-impl jar is mutually
exclusive with log4j-to-slf4j jar "
- + "(the first routes calls from SLF4J to Log4j, the second
from Log4j to SLF4J)");
- } catch (Throwable classNotFoundIsGood) {
- // org.slf4j.helpers.Log4JLoggerFactory is not on classpath. Good!
- }
- }
-
public Object getExternalContext() {
return null;
}
Modified:
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java?rev=1478075&r1=1478074&r2=1478075&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
(original)
+++
logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
Wed May 1 16:22:05 2013
@@ -27,6 +27,21 @@ import java.net.URI;
public class SLF4JLoggerContextFactory implements LoggerContextFactory {
private static LoggerContext context = new SLF4JLoggerContext();
+ public SLF4JLoggerContextFactory() {
+ // LOG4J2-230, LOG4J2-204 (improve error reporting when misconfigured)
+ boolean misconfigured = false;
+ try {
+ Class.forName("org.slf4j.helpers.Log4JLoggerFactory");
+ misconfigured = true;
+ } catch (Throwable classNotFoundIsGood) {
+ // org.slf4j.helpers.Log4JLoggerFactory is not on classpath. Good!
+ }
+ if (misconfigured) {
+ throw new IllegalStateException("slf4j-impl jar is mutually
exclusive with log4j-to-slf4j jar "
+ + "(the first routes calls from SLF4J to Log4j, the second
from Log4j to SLF4J)");
+ }
+ }
+
public LoggerContext getContext(final String fqcn, final ClassLoader
loader, final boolean currentContext) {
return context;
}
Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1478075&r1=1478074&r2=1478075&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Wed May 1 16:22:05 2013
@@ -23,6 +23,9 @@
<body>
<release version="2.0-beta6" date="@TBD@" description="Bug fixes and
enhancements">
+ <action issue="LOG4J2-230" dev="rpopma" type="update" due-to="Wojciech
ZarÄba">
+ Improved error reporting when misconfigured.
+ </action>
<action issue="LOG4J2-222" dev="rgoers" type="fix" due-to="Steven Yang">
Disruptor will now shutdown during Tomcat shutdown.
</action>