slf4j-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
April 2010
- 10 participants
- 50 discussions

[Bug 127] LocationAwareLogger does not have a method that accepts the argument array
by bugzilla-daemon@pixie.qos.ch 08 Apr '10
by bugzilla-daemon@pixie.qos.ch 08 Apr '10
08 Apr '10
http://bugzilla.slf4j.org/show_bug.cgi?id=127
Ceki Gulcu <lists(a)slf4j.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #4 from Ceki Gulcu <lists(a)slf4j.org> 2010-04-09 00:24:22 ---
Fixed in http://github.com/ceki/slf4j/commit/6dd2bd58cffc857d064d0
The log method in LocationAwareLogger interface now admits an additional
parameter of type Object[] representing additional arguments of the log
request. Due to this modification, slf4j-api version 1.6.x will not work with
bindings shipping with SLF4J 1.5.x -- bindings shipping with 1.6.x must be
used.
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-11-g6dd2bd5
by git-noreply@pixie.qos.ch 08 Apr '10
by git-noreply@pixie.qos.ch 08 Apr '10
08 Apr '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 6dd2bd58cffc857d064d0e0ac3017d6aee924bb8 (commit)
from d1d27b8d8748190f397b0be72c8d85722f8c5b00 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=6dd2bd58cffc857d064d0e0ac3…
http://github.com/ceki/slf4j/commit/6dd2bd58cffc857d064d0e0ac3017d6aee924bb8
commit 6dd2bd58cffc857d064d0e0ac3017d6aee924bb8
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Fri Apr 9 00:21:28 2010 +0200
Fixing http://bugzilla.slf4j.org/show_bug.cgi?id=127
The log method in LocationAwareLogger interface now admits an
additional parameter of type Object[] representing additional
arguments of the log request. Due to this modification, slf4j-api
version 1.6.x will not work with bindings shipping with SLF4J 1.5.x --
bindings shipping with 1.6.x must be used.
diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
index 7171784..727951c 100644
--- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
+++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLocationAwareLog.java
@@ -38,7 +38,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
private static final long serialVersionUID = -2379157579039314822L;
- //used to store this logger's name to recreate it after serialization
+ // used to store this logger's name to recreate it after serialization
protected String name;
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
@@ -105,7 +105,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void trace(Object message) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -119,7 +119,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void trace(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
@@ -131,7 +131,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void debug(Object message) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -145,7 +145,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void debug(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
@@ -157,7 +157,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void info(Object message) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -171,7 +171,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void info(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
@@ -183,7 +183,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void warn(Object message) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -197,7 +197,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void warn(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
@@ -209,7 +209,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void error(Object message) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -223,7 +223,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void error(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
@@ -235,7 +235,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void fatal(Object message) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String
- .valueOf(message), null);
+ .valueOf(message), null, null);
}
/**
@@ -249,7 +249,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
*/
public void fatal(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String
- .valueOf(message), t);
+ .valueOf(message), null, t);
}
/**
diff --git a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
index 1a3a111..850b989 100644
--- a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
+++ b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
@@ -189,7 +189,7 @@ public class SLF4JBridgeHandler extends Handler {
slf4jLevel = LocationAwareLogger.ERROR_INT;
}
String i18nMessage = getMessageI18N(record);
- lal.log(null, FQCN, slf4jLevel, i18nMessage, record.getThrown());
+ lal.log(null, FQCN, slf4jLevel, i18nMessage, null, record.getThrown());
}
protected void callPlainSLF4JLogger(Logger slf4jLogger, LogRecord record) {
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
index 0d5d765..5aaae14 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java
@@ -45,8 +45,6 @@ public class Category {
protected org.slf4j.Logger slf4jLogger;
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
-
-
private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
Category(String name) {
@@ -175,7 +173,7 @@ public class Category {
Throwable t) {
String m = convertToString(message);
if (locationAwareLogger != null) {
- locationAwareLogger.log(marker, fqcn, level, m, t);
+ locationAwareLogger.log(marker, fqcn, level, m, null, t);
} else {
switch (level) {
case LocationAwareLogger.TRACE_INT:
diff --git a/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java b/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java
index 9786551..523589d 100644
--- a/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java
+++ b/slf4j-api/src/main/java/org/slf4j/spi/LocationAwareLogger.java
@@ -55,6 +55,6 @@ public interface LocationAwareLogger extends Logger {
* @param message
* @param t
*/
- public void log(Marker marker, String fqcn, int level, String message, Throwable t);
+ public void log(Marker marker, String fqcn, int level, String message, Object[] argArray, Throwable t);
}
diff --git a/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLogger.java b/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLogger.java
index 6cf2075..761143a 100644
--- a/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLogger.java
+++ b/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLogger.java
@@ -49,9 +49,9 @@ public class LocLogger extends LoggerWrapper implements Logger {
final IMessageConveyor imc;
- public LocLogger(Logger logger, IMessageConveyor imc) {
+ public LocLogger(Logger logger, IMessageConveyor imc) {
super(logger, LoggerWrapper.class.getName());
- if(imc == null) {
+ if (imc == null) {
throw new IllegalArgumentException("IMessageConveyor cannot be null");
}
this.imc = imc;
@@ -74,7 +74,7 @@ public class LocLogger extends LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(LOCALIZED, FQCN,
- LocationAwareLogger.TRACE_INT, translatedMsg, null);
+ LocationAwareLogger.TRACE_INT, translatedMsg, args, null);
} else {
logger.trace(LOCALIZED, translatedMsg, mpo);
}
@@ -97,7 +97,7 @@ public class LocLogger extends LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(LOCALIZED, FQCN,
- LocationAwareLogger.DEBUG_INT, translatedMsg, null);
+ LocationAwareLogger.DEBUG_INT, translatedMsg, args, null);
} else {
logger.debug(LOCALIZED, translatedMsg, mpo);
}
@@ -120,7 +120,7 @@ public class LocLogger extends LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(LOCALIZED, FQCN,
- LocationAwareLogger.INFO_INT, translatedMsg, null);
+ LocationAwareLogger.INFO_INT, translatedMsg, args, null);
} else {
logger.info(LOCALIZED, translatedMsg, mpo);
}
@@ -143,7 +143,7 @@ public class LocLogger extends LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(LOCALIZED, FQCN,
- LocationAwareLogger.WARN_INT, translatedMsg, null);
+ LocationAwareLogger.WARN_INT, translatedMsg, args, null);
} else {
logger.warn(LOCALIZED, translatedMsg, mpo);
}
@@ -166,7 +166,7 @@ public class LocLogger extends LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(LOCALIZED, FQCN,
- LocationAwareLogger.ERROR_INT, translatedMsg, null);
+ LocationAwareLogger.ERROR_INT, translatedMsg, args, null);
} else {
logger.error(LOCALIZED, translatedMsg, mpo);
}
diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/EventLogger.java b/slf4j-ext/src/main/java/org/slf4j/ext/EventLogger.java
index e3a26b4..2f77c1b 100755
--- a/slf4j-ext/src/main/java/org/slf4j/ext/EventLogger.java
+++ b/slf4j-ext/src/main/java/org/slf4j/ext/EventLogger.java
@@ -34,7 +34,7 @@ public class EventLogger {
public static void logEvent(EventData data) {
if (eventLogger.instanceofLAL) {
((LocationAwareLogger) eventLogger.logger).log(EVENT_MARKER, FQCN,
- LocationAwareLogger.INFO_INT, data.toXML(), null);
+ LocationAwareLogger.INFO_INT, data.toXML(), null, null);
} else {
eventLogger.logger.info(EVENT_MARKER, data.toXML(), data);
}
diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java b/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
index 5ca7aeb..75f8e65 100644
--- a/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
+++ b/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java
@@ -6,27 +6,27 @@ import org.slf4j.helpers.MessageFormatter;
import org.slf4j.spi.LocationAwareLogger;
/**
- * A helper class wrapping an {@link org.slf4j.Logger}
- * instance preserving location information if the wrapped
- * instance supports it.
+ * A helper class wrapping an {@link org.slf4j.Logger} instance preserving
+ * location information if the wrapped instance supports it.
*
* @author Ralph Goers
* @author Ceki Gülcü
*/
public class LoggerWrapper implements Logger {
- // To ensure consistency between two instances sharing the same name (homonyms)
- // a LoggerWrapper should not contain any state beyond
+ // To ensure consistency between two instances sharing the same name
+ // (homonyms)
+ // a LoggerWrapper should not contain any state beyond
// the Logger instance it wraps.
// Note that 'instanceofLAL' directly depends on Logger.
// fqcn depend on the caller, but its value would not be different
// between successive invocations of a factory class
-
+
protected final Logger logger;
final String fqcn;
// is this logger instance a LocationAwareLogger
protected final boolean instanceofLAL;
-
+
public LoggerWrapper(Logger logger, String fqcn) {
this.logger = logger;
this.fqcn = fqcn;
@@ -36,7 +36,7 @@ public class LoggerWrapper implements Logger {
instanceofLAL = false;
}
}
-
+
/**
* Delegate to the appropriate method of the underlying logger.
*/
@@ -60,7 +60,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.TRACE_INT, msg, null);
+ LocationAwareLogger.TRACE_INT, msg, null, null);
} else {
logger.trace(msg);
}
@@ -76,7 +76,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.trace(format, arg);
}
@@ -92,7 +93,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.trace(format, arg1, arg2);
}
@@ -108,7 +110,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null);
} else {
logger.trace(format, argArray);
}
@@ -123,7 +125,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.TRACE_INT, msg, t);
+ LocationAwareLogger.TRACE_INT, msg, null, t);
} else {
logger.trace(msg, t);
}
@@ -137,7 +139,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.TRACE_INT, msg, null);
+ LocationAwareLogger.TRACE_INT, msg, null, null);
} else {
logger.trace(marker, msg);
}
@@ -152,7 +154,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.trace(marker, format, arg);
}
@@ -167,7 +170,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.trace(marker, format, arg1, arg2);
}
@@ -182,7 +186,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null);
} else {
logger.trace(marker, format, argArray);
}
@@ -196,7 +200,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.TRACE_INT, msg, t);
+ LocationAwareLogger.TRACE_INT, msg, null, t);
} else {
logger.trace(marker, msg, t);
}
@@ -225,7 +229,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.DEBUG_INT, msg, null);
+ LocationAwareLogger.DEBUG_INT, msg, null, null);
} else {
logger.debug(msg);
}
@@ -241,7 +245,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.debug(format, arg);
}
@@ -257,7 +262,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.debug(format, arg1, arg2);
}
@@ -273,7 +279,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage, argArray, null);
} else {
logger.debug(format, argArray);
}
@@ -288,7 +294,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.DEBUG_INT, msg, t);
+ LocationAwareLogger.DEBUG_INT, msg, null, t);
} else {
logger.debug(msg, t);
}
@@ -302,7 +308,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.DEBUG_INT, msg, null);
+ LocationAwareLogger.DEBUG_INT, msg, null, null);
} else {
logger.debug(marker, msg);
}
@@ -317,7 +323,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.debug(marker, format, arg);
}
@@ -332,7 +339,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.debug(marker, format, arg1, arg2);
}
@@ -347,7 +355,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.DEBUG_INT, formattedMessage, null);
+ LocationAwareLogger.DEBUG_INT, formattedMessage, argArray, null);
} else {
logger.debug(marker, format, argArray);
}
@@ -361,7 +369,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.DEBUG_INT, msg, t);
+ LocationAwareLogger.DEBUG_INT, msg, null, t);
} else {
logger.debug(marker, msg, t);
}
@@ -390,7 +398,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.INFO_INT, msg, null);
+ LocationAwareLogger.INFO_INT, msg, null, null);
} else {
logger.info(msg);
}
@@ -406,7 +414,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, new Object[] { arg },
+ null);
} else {
logger.info(format, arg);
}
@@ -422,7 +431,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.info(format, arg1, arg2);
}
@@ -438,7 +448,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, argArray, null);
} else {
logger.info(format, argArray);
}
@@ -453,7 +463,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.INFO_INT, msg, t);
+ LocationAwareLogger.INFO_INT, msg, null, t);
} else {
logger.info(msg, t);
}
@@ -467,7 +477,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.INFO_INT, msg, null);
+ LocationAwareLogger.INFO_INT, msg, null, null);
} else {
logger.info(marker, msg);
}
@@ -482,7 +492,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, new Object[] { arg },
+ null);
} else {
logger.info(marker, format, arg);
}
@@ -497,7 +508,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.info(marker, format, arg1, arg2);
}
@@ -512,7 +524,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.INFO_INT, formattedMessage, null);
+ LocationAwareLogger.INFO_INT, formattedMessage, argArray, null);
} else {
logger.info(marker, format, argArray);
}
@@ -526,7 +538,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.INFO_INT, msg, t);
+ LocationAwareLogger.INFO_INT, msg, null, t);
} else {
logger.info(marker, msg, t);
}
@@ -552,7 +564,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.WARN_INT, msg, null);
+ LocationAwareLogger.WARN_INT, msg, null, null);
} else {
logger.warn(msg);
}
@@ -568,7 +580,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, new Object[] { arg },
+ null);
} else {
logger.warn(format, arg);
}
@@ -584,7 +597,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.warn(format, arg1, arg2);
}
@@ -600,7 +614,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, argArray, null);
} else {
logger.warn(format, argArray);
}
@@ -615,7 +629,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.WARN_INT, msg, t);
+ LocationAwareLogger.WARN_INT, msg, null, t);
} else {
logger.warn(msg, t);
}
@@ -629,7 +643,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.WARN_INT, msg, null);
+ LocationAwareLogger.WARN_INT, msg, null, null);
} else {
logger.warn(marker, msg);
}
@@ -644,7 +658,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, new Object[] { arg },
+ null);
} else {
logger.warn(marker, format, arg);
}
@@ -659,7 +674,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.warn(marker, format, arg1, arg2);
}
@@ -674,7 +690,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.WARN_INT, formattedMessage, null);
+ LocationAwareLogger.WARN_INT, formattedMessage, argArray, null);
} else {
logger.warn(marker, format, argArray);
}
@@ -688,7 +704,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.WARN_INT, msg, t);
+ LocationAwareLogger.WARN_INT, msg, null, t);
} else {
logger.warn(marker, msg, t);
}
@@ -717,7 +733,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.ERROR_INT, msg, null);
+ LocationAwareLogger.ERROR_INT, msg, null, null);
} else {
logger.error(msg);
}
@@ -733,7 +749,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.error(format, arg);
}
@@ -749,7 +766,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.error(format, arg1, arg2);
}
@@ -765,7 +783,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null);
} else {
logger.error(format, argArray);
}
@@ -780,7 +798,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(null, fqcn,
- LocationAwareLogger.ERROR_INT, msg, t);
+ LocationAwareLogger.ERROR_INT, msg, null, t);
} else {
logger.error(msg, t);
}
@@ -794,7 +812,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.ERROR_INT, msg, null);
+ LocationAwareLogger.ERROR_INT, msg, null, null);
} else {
logger.error(marker, msg);
}
@@ -809,7 +827,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage,
+ new Object[] { arg }, null);
} else {
logger.error(marker, format, arg);
}
@@ -824,7 +843,8 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.format(format, arg1, arg2);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage, new Object[] { arg1,
+ arg2 }, null);
} else {
logger.error(marker, format, arg1, arg2);
}
@@ -839,7 +859,7 @@ public class LoggerWrapper implements Logger {
if (instanceofLAL) {
String formattedMessage = MessageFormatter.arrayFormat(format, argArray);
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.ERROR_INT, formattedMessage, null);
+ LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null);
} else {
logger.error(marker, format, argArray);
}
@@ -853,7 +873,7 @@ public class LoggerWrapper implements Logger {
return;
if (instanceofLAL) {
((LocationAwareLogger) logger).log(marker, fqcn,
- LocationAwareLogger.ERROR_INT, msg, t);
+ LocationAwareLogger.ERROR_INT, msg, null, t);
} else {
logger.error(marker, msg, t);
}
diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java b/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
index 10087de..93510b0 100644
--- a/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
+++ b/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
@@ -48,11 +48,11 @@ public class XLogger extends LoggerWrapper implements Logger {
}
public enum Level {
- TRACE("TRACE", LocationAwareLogger.TRACE_INT),
- DEBUG("DEBUG", LocationAwareLogger.DEBUG_INT),
- INFO("INFO", LocationAwareLogger.INFO_INT),
- WARN("WARN", LocationAwareLogger.WARN_INT),
- ERROR("ERROR", LocationAwareLogger.ERROR_INT);
+ TRACE("TRACE", LocationAwareLogger.TRACE_INT), DEBUG("DEBUG",
+ LocationAwareLogger.DEBUG_INT), INFO("INFO",
+ LocationAwareLogger.INFO_INT), WARN("WARN",
+ LocationAwareLogger.WARN_INT), ERROR("ERROR",
+ LocationAwareLogger.ERROR_INT);
private final String name;
private final int level;
@@ -75,7 +75,7 @@ public class XLogger extends LoggerWrapper implements Logger {
* Given an underlying logger, construct an XLogger
*
* @param logger
- * underlying logger
+ * underlying logger
*/
public XLogger(Logger logger) {
// If class B extends A, assuming B does not override method x(), the caller
@@ -88,7 +88,7 @@ public class XLogger extends LoggerWrapper implements Logger {
* Log method entry.
*
* @param argArray
- * supplied parameters
+ * supplied parameters
*/
public void entry(Object... argArray) {
if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
@@ -101,7 +101,7 @@ public class XLogger extends LoggerWrapper implements Logger {
String formattedMessage = MessageFormatter.arrayFormat(messagePattern,
argArray);
((LocationAwareLogger) logger).log(ENTRY_MARKER, FQCN,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null);
}
}
@@ -111,7 +111,7 @@ public class XLogger extends LoggerWrapper implements Logger {
public void exit() {
if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
((LocationAwareLogger) logger).log(EXIT_MARKER, FQCN,
- LocationAwareLogger.TRACE_INT, EXIT_MESSAGE_0, null);
+ LocationAwareLogger.TRACE_INT, EXIT_MESSAGE_0, null, null);
}
}
@@ -119,13 +119,14 @@ public class XLogger extends LoggerWrapper implements Logger {
* Log method exit
*
* @param result
- * The result of the method being exited
+ * The result of the method being exited
*/
public void exit(Object result) {
if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
String formattedMessage = MessageFormatter.format(EXIT_MESSAGE_1, result);
((LocationAwareLogger) logger).log(EXIT_MARKER, FQCN,
- LocationAwareLogger.TRACE_INT, formattedMessage, null);
+ LocationAwareLogger.TRACE_INT, formattedMessage,
+ new Object[] { result }, null);
}
}
@@ -133,26 +134,27 @@ public class XLogger extends LoggerWrapper implements Logger {
* Log an exception being thrown. The generated log event uses Level ERROR.
*
* @param throwable
- * the exception being caught.
+ * the exception being caught.
*/
public void throwing(Throwable throwable) {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN,
- LocationAwareLogger.ERROR_INT, "throwing", throwable);
+ LocationAwareLogger.ERROR_INT, "throwing", null, throwable);
}
}
/**
* Log an exception being thrown allowing the log level to be specified.
- *
- * @param level the logging level to use.
+ *
+ * @param level
+ * the logging level to use.
* @param throwable
- * the exception being caught.
+ * the exception being caught.
*/
public void throwing(Level level, Throwable throwable) {
if (instanceofLAL) {
- ((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN,
- level.level, "throwing", throwable);
+ ((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN, level.level,
+ "throwing", null, throwable);
}
}
@@ -160,26 +162,27 @@ public class XLogger extends LoggerWrapper implements Logger {
* Log an exception being caught. The generated log event uses Level ERROR.
*
* @param throwable
- * the exception being caught.
+ * the exception being caught.
*/
public void catching(Throwable throwable) {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(CATCHING_MARKER, FQCN,
- LocationAwareLogger.ERROR_INT, "catching", throwable);
+ LocationAwareLogger.ERROR_INT, "catching", null, throwable);
}
}
/**
* Log an exception being caught allowing the log level to be specified.
- *
- * @param level the logging level to use.
+ *
+ * @param level
+ * the logging level to use.
* @param throwable
- * the exception being caught.
+ * the exception being caught.
*/
public void catching(Level level, Throwable throwable) {
if (instanceofLAL) {
- ((LocationAwareLogger) logger).log(CATCHING_MARKER, FQCN,
- level.level, "catching", throwable);
+ ((LocationAwareLogger) logger).log(CATCHING_MARKER, FQCN, level.level,
+ "catching", null, throwable);
}
}
diff --git a/slf4j-jdk14/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java b/slf4j-jdk14/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java
index 4b6401b..55a8d5e 100644
--- a/slf4j-jdk14/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java
+++ b/slf4j-jdk14/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java
@@ -77,8 +77,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at level FINEST.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void trace(String msg) {
if (logger.isLoggable(Level.FINEST)) {
@@ -177,8 +177,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at level FINE.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void debug(String msg) {
if (logger.isLoggable(Level.FINE)) {
@@ -276,8 +276,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the INFO level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void info(String msg) {
if (logger.isLoggable(Level.INFO)) {
@@ -377,8 +377,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the WARNING level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void warn(String msg) {
if (logger.isLoggable(Level.WARNING)) {
@@ -478,8 +478,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the SEVERE level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void error(String msg) {
if (logger.isLoggable(Level.SEVERE)) {
@@ -626,9 +626,9 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
record.setSourceMethodName(ste.getMethodName());
}
}
-
+
public void log(Marker marker, String callerFQCN, int level, String message,
- Throwable t) {
+ Object[] argArray, Throwable t) {
Level julLevel;
switch (level) {
case LocationAwareLogger.TRACE_INT:
@@ -650,12 +650,12 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements
throw new IllegalStateException("Level number " + level
+ " is not recognized.");
}
- // the logger.isLoggable check avoids the unconditional
+ // the logger.isLoggable check avoids the unconditional
// construction of location data for disabled log
- // statements. As of 2008-07-31, callers of this method
- // do not perform this check. See also
+ // statements. As of 2008-07-31, callers of this method
+ // do not perform this check. See also
// http://bugzilla.slf4j.org/show_bug.cgi?id=90
- if(logger.isLoggable(julLevel)) {
+ if (logger.isLoggable(julLevel)) {
log(callerFQCN, julLevel, message, t);
}
}
diff --git a/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java b/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java
index 3901675..bfe6444 100644
--- a/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java
+++ b/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java
@@ -22,7 +22,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
package org.slf4j.impl;
import java.io.Serializable;
@@ -36,11 +35,13 @@ import org.slf4j.spi.LocationAwareLogger;
/**
* A wrapper over {@link org.apache.log4j.Logger org.apache.log4j.Logger} in
- * conforming to the {@link Logger} interface.
+ * conforming to the {@link Logger} interface.
*
- * <p>Note that the logging levels mentioned in this class refer to those defined in the <a
- * href="http://logging.apache.org/log4j/docs/api/org/apache/log4j/Level.html"><code>org.apache.log4j.Level</code></a>
- * class.
+ * <p>
+ * Note that the logging levels mentioned in this class refer to those defined
+ * in the <a
+ * href="http://logging.apache.org/log4j/docs/api/org/apache/log4j/Level.html">
+ * <code>org.apache.log4j.Level</code></a> class.
*
* <p>
* The TRACE level was introduced in log4j version 1.2.12. In order to avoid
@@ -101,8 +102,8 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at level TRACE.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void trace(String msg) {
logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, null);
@@ -118,9 +119,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg
- * the argument
+ * the argument
*/
public void trace(String format, Object arg) {
if (isTraceEnabled()) {
@@ -139,11 +140,11 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg1
- * the first argument
+ * the first argument
* @param arg2
- * the second argument
+ * the second argument
*/
public void trace(String format, Object arg1, Object arg2) {
if (isTraceEnabled()) {
@@ -162,9 +163,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param argArray
- * an array of arguments
+ * an array of arguments
*/
public void trace(String format, Object[] argArray) {
if (isTraceEnabled()) {
@@ -177,9 +178,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* Log an exception (throwable) at level TRACE with an accompanying message.
*
* @param msg
- * the message accompanying the exception
+ * the message accompanying the exception
* @param t
- * the exception (throwable) to log
+ * the exception (throwable) to log
*/
public void trace(String msg, Throwable t) {
logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, t);
@@ -197,8 +198,8 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at level DEBUG.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void debug(String msg) {
logger.log(FQCN, Level.DEBUG, msg, null);
@@ -214,9 +215,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg
- * the argument
+ * the argument
*/
public void debug(String format, Object arg) {
if (logger.isDebugEnabled()) {
@@ -235,11 +236,11 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg1
- * the first argument
+ * the first argument
* @param arg2
- * the second argument
+ * the second argument
*/
public void debug(String format, Object arg1, Object arg2) {
if (logger.isDebugEnabled()) {
@@ -258,9 +259,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param argArray
- * an array of arguments
+ * an array of arguments
*/
public void debug(String format, Object[] argArray) {
if (logger.isDebugEnabled()) {
@@ -273,9 +274,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* Log an exception (throwable) at level DEBUG with an accompanying message.
*
* @param msg
- * the message accompanying the exception
+ * the message accompanying the exception
* @param t
- * the exception (throwable) to log
+ * the exception (throwable) to log
*/
public void debug(String msg, Throwable t) {
logger.log(FQCN, Level.DEBUG, msg, t);
@@ -293,8 +294,8 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the INFO level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void info(String msg) {
logger.log(FQCN, Level.INFO, msg, null);
@@ -309,9 +310,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg
- * the argument
+ * the argument
*/
public void info(String format, Object arg) {
if (logger.isInfoEnabled()) {
@@ -330,11 +331,11 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg1
- * the first argument
+ * the first argument
* @param arg2
- * the second argument
+ * the second argument
*/
public void info(String format, Object arg1, Object arg2) {
if (logger.isInfoEnabled()) {
@@ -353,9 +354,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param argArray
- * an array of arguments
+ * an array of arguments
*/
public void info(String format, Object[] argArray) {
if (logger.isInfoEnabled()) {
@@ -369,9 +370,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* message.
*
* @param msg
- * the message accompanying the exception
+ * the message accompanying the exception
* @param t
- * the exception (throwable) to log
+ * the exception (throwable) to log
*/
public void info(String msg, Throwable t) {
logger.log(FQCN, Level.INFO, msg, t);
@@ -389,8 +390,8 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the WARN level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void warn(String msg) {
logger.log(FQCN, Level.WARN, msg, null);
@@ -406,9 +407,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg
- * the argument
+ * the argument
*/
public void warn(String format, Object arg) {
if (logger.isEnabledFor(Level.WARN)) {
@@ -427,11 +428,11 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg1
- * the first argument
+ * the first argument
* @param arg2
- * the second argument
+ * the second argument
*/
public void warn(String format, Object arg1, Object arg2) {
if (logger.isEnabledFor(Level.WARN)) {
@@ -450,9 +451,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param argArray
- * an array of arguments
+ * an array of arguments
*/
public void warn(String format, Object[] argArray) {
if (logger.isEnabledFor(Level.WARN)) {
@@ -466,9 +467,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* message.
*
* @param msg
- * the message accompanying the exception
+ * the message accompanying the exception
* @param t
- * the exception (throwable) to log
+ * the exception (throwable) to log
*/
public void warn(String msg, Throwable t) {
logger.log(FQCN, Level.WARN, msg, t);
@@ -486,8 +487,8 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
/**
* Log a message object at the ERROR level.
*
- * @param msg -
- * the message object to be logged
+ * @param msg
+ * - the message object to be logged
*/
public void error(String msg) {
logger.log(FQCN, Level.ERROR, msg, null);
@@ -503,9 +504,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg
- * the argument
+ * the argument
*/
public void error(String format, Object arg) {
if (logger.isEnabledFor(Level.ERROR)) {
@@ -524,11 +525,11 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param arg1
- * the first argument
+ * the first argument
* @param arg2
- * the second argument
+ * the second argument
*/
public void error(String format, Object arg1, Object arg2) {
if (logger.isEnabledFor(Level.ERROR)) {
@@ -547,9 +548,9 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* </p>
*
* @param format
- * the format string
+ * the format string
* @param argArray
- * an array of arguments
+ * an array of arguments
*/
public void error(String format, Object[] argArray) {
if (logger.isEnabledFor(Level.ERROR)) {
@@ -563,16 +564,16 @@ public final class Log4jLoggerAdapter extends MarkerIgnoringBase implements
* message.
*
* @param msg
- * the message accompanying the exception
+ * the message accompanying the exception
* @param t
- * the exception (throwable) to log
+ * the exception (throwable) to log
*/
public void error(String msg, Throwable t) {
logger.log(FQCN, Level.ERROR, msg, t);
}
public void log(Marker marker, String callerFQCN, int level, String msg,
- Throwable t) {
+ Object[] argArray, Throwable t) {
Level log4jLevel;
switch (level) {
case LocationAwareLogger.TRACE_INT:
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 7ff7bab..24b0b39 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -34,6 +34,14 @@
series is expected to require JDK 1.5 or later.
</p>
+ <p>The <code>log</code> method in <code>LocationAwareLogger</code>
+ interface now admits an additional parameter of type
+ <code>Object[]</code> representing additional arguments of the log
+ request. Due to this modification, slf4j-api version 1.6.x will not
+ work with bindings shipping with SLF4J 1.5.x -- bindings shipping
+ with 1.6.x must be used.
+ </p>
+
<p>Note that as of SLF4J version 1.6.0, in the absence of an SLF4J
binding, slf4j-api will default to a no-operation implementation
discarding all log requests. Thus, instead of throwing an
-----------------------------------------------------------------------
Summary of changes:
.../logging/impl/SLF4JLocationAwareLog.java | 26 ++--
.../java/org/slf4j/bridge/SLF4JBridgeHandler.java | 2 +-
.../src/main/java/org/apache/log4j/Category.java | 4 +-
.../java/org/slf4j/spi/LocationAwareLogger.java | 2 +-
.../src/main/java/org/slf4j/cal10n/LocLogger.java | 14 +-
.../src/main/java/org/slf4j/ext/EventLogger.java | 2 +-
.../src/main/java/org/slf4j/ext/LoggerWrapper.java | 136 +++++++++++---------
slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java | 53 ++++----
.../java/org/slf4j/impl/JDK14LoggerAdapter.java | 32 +++---
.../java/org/slf4j/impl/Log4jLoggerAdapter.java | 123 +++++++++---------
slf4j-site/src/site/pages/news.html | 8 +
11 files changed, 216 insertions(+), 186 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[Bug 159] Default to a behavior when no adapter found in the classpath
by bugzilla-daemon@pixie.qos.ch 06 Apr '10
by bugzilla-daemon@pixie.qos.ch 06 Apr '10
06 Apr '10
http://bugzilla.slf4j.org/show_bug.cgi?id=159
Ceki Gulcu <lists(a)slf4j.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lists(a)slf4j.org
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Ceki Gulcu <lists(a)slf4j.org> 2010-04-06 14:00:10 ---
Fixed in http://github.com/ceki/slf4j/commit/d1d27b8d
As of SLF4J version 1.6.0, in the absence of an SLF4J binding, slf4j-api will
default to a no-operation implementation discarding all log requests. Thus,
instead of throwing an exception, SLF4J will emit a single warning message
about the absence of a binding and proceed to discard all log requests without
further protest.
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-10-gd1d27b8
by git-noreply@pixie.qos.ch 06 Apr '10
by git-noreply@pixie.qos.ch 06 Apr '10
06 Apr '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via d1d27b8d8748190f397b0be72c8d85722f8c5b00 (commit)
from a19566c1e0752a651057279e80384ef5ac37dfae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=d1d27b8d8748190f397b0be72c…
http://github.com/ceki/slf4j/commit/d1d27b8d8748190f397b0be72c8d85722f8c5b00
commit d1d27b8d8748190f397b0be72c8d85722f8c5b00
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Apr 6 13:57:15 2010 +0200
As of SLF4J version 1.6.0, in the absence of an SLF4J binding,
slf4j-api will default to a no-operation implementation discarding all
log requests. Thus, instead of throwing an exception, SLF4J will emit
a single warning message about the absence of a binding and proceed to
discard all log requests without further protest.
diff --git a/integration/build.xml b/integration/build.xml
index d4e88a6..3c6e323 100644
--- a/integration/build.xml
+++ b/integration/build.xml
@@ -14,12 +14,18 @@
<echo message="test classpath: ${test_classpath}" />
<echo message="plugin classpath: ${plugin_classpath}" />
- <path id="path150">
+
+ <path id="path142Binding">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
- <pathelement location="./lib/slf4j-simple-1.5.0.jar" />
+ <pathelement location="./lib/slf4j-simple-1.4.2.jar" />
</path >
+ <path id="path150Binding">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-simple-1.5.0.jar" />
+ </path >
<path id="path1511API">
<pathelement location="target/test-classes/" />
@@ -33,14 +39,13 @@
<pathelement location="./lib/slf4j-simple-1.5.11.jar" />
</path >
-
-
- <path id="pathIncompatible">
+ <!--<path id="pathIncompatible">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-INCOMPATIBLE.jar" />
</path >
-
+ -->
+
<path id="pathCurrent">
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
@@ -101,23 +106,35 @@
</target>
<target name="testAll" depends="init,
- testMismatch,
- testPre155,
+ testMissingSingletonMethod,
+ testMismatch,
testMatch,
testMultiBinding,
testFuture_16Series">
</target>
- <target name="testMismatch">
- <junit printsummary="yes" fork="no" haltonfailure="yes">
- <classpath refid="pathIncompatible" />
+ <target name="testMissingSingletonMethod">
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="path142Binding" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
- outfile="TEST-INCOMPATIBLE"
- name="org.slf4j.VersionMismatchAssertionTest" />
+ outfile="TEST-142BININDING"
+ name="org.slf4j.MissingSingletonMethodAssertionTest" />
</junit>
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="path150Binding" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-150BINDING"
+ name="org.slf4j.MissingSingletonMethodAssertionTest" />
+ </junit>
+
+ </target>
+
+ <target name="testMismatch">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="path1511API" />
@@ -137,16 +154,6 @@
</junit>
</target>
-
- <target name="testPre155">
- <junit printsummary="yes" fork="no" haltonfailure="yes">
- <classpath refid="path150" />
- <formatter type="plain" />
- <test fork="yes" todir="target/unit-reports"
- outfile="TEST-testPre155"
- name="org.slf4j.CompatibilityAssertionTest" />
- </junit>
- </target>
<target name="testMatch">
<junit printsummary="yes" fork="no" haltonfailure="yes">
@@ -173,7 +180,7 @@
<classpath refid="binding1699" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
- outfile="TEST-_binding1699"
+ outfile="TEST-binding1699"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
@@ -181,7 +188,7 @@
<classpath refid="binding2099" />
<formatter type="plain" />
<test fork="yes" todir="target/unit-reports"
- outfile="TEST-_binding2099"
+ outfile="TEST-binding2099"
name="org.slf4j.CompatibilityAssertionTest" />
</junit>
diff --git a/integration/lib/slf4j-simple-1.4.2.jar b/integration/lib/slf4j-simple-1.4.2.jar
new file mode 100644
index 0000000..d2e332d
Binary files /dev/null and b/integration/lib/slf4j-simple-1.4.2.jar differ
diff --git a/integration/lib/slf4j-simple-INCOMPATIBLE.jar b/integration/lib/slf4j-simple-INCOMPATIBLE.jar
deleted file mode 100644
index 0f6b680..0000000
Binary files a/integration/lib/slf4j-simple-INCOMPATIBLE.jar and /dev/null differ
diff --git a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
similarity index 59%
copy from integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
copy to integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
index daa81f9..cf30f9b 100644
--- a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MissingSingletonMethodAssertionTest.java
@@ -29,13 +29,13 @@ import java.util.Random;
import junit.framework.TestCase;
-public class MultiBindingAssertionTest extends TestCase {
+public class MissingSingletonMethodAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
- public MultiBindingAssertionTest(String name) {
+ public MissingSingletonMethodAssertionTest(String name) {
super(name);
}
@@ -50,13 +50,38 @@ public class MultiBindingAssertionTest extends TestCase {
}
public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- assertTrue("number of lines should be greater than 4", sps.stringList
- .size() > 4);
- String s0 = (String) sps.stringList.get(0);
- assertTrue(s0
- .contains("SLF4J: Class path contains multiple SLF4J bindings."));
+ try {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ fail("NoSuchMethodError expected");
+ } catch (NoSuchMethodError e) {
+ }
+
+ int lineCount = sps.stringList
+ .size();
+ assertTrue("number of lines should be 3 but was "+lineCount, lineCount == 3);
+
+
+ // expected output:
+ // SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
+ // SLF4J: Your binding is version 1.4.x or earlier.
+ // SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
+
+ {
+ String s = (String) sps.stringList.get(0);
+ assertTrue(s
+ .contains("SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding."));
+ }
+ {
+ String s = (String) sps.stringList.get(1);
+ assertTrue(s.contains("SLF4J: Your binding is version 1.5.5 or earlier."));
+ }
+ {
+ String s = (String) sps.stringList.get(2);
+ assertTrue(s
+ .contains("SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x"));
+ }
+
}
}
diff --git a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
index daa81f9..a85bfa4 100644
--- a/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
+++ b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
@@ -25,6 +25,7 @@
package org.slf4j;
import java.io.PrintStream;
+import java.util.List;
import java.util.Random;
import junit.framework.TestCase;
@@ -50,13 +51,25 @@ public class MultiBindingAssertionTest extends TestCase {
}
public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- assertTrue("number of lines should be greater than 4", sps.stringList
- .size() > 4);
- String s0 = (String) sps.stringList.get(0);
- assertTrue(s0
- .contains("SLF4J: Class path contains multiple SLF4J bindings."));
+ try {
+ Logger logger = LoggerFactory.getLogger(this.getClass());
+ String msg = "hello world " + diff;
+ logger.info(msg);
+ fail("was expecting NoSuchMethodError");
+ } catch (NoSuchMethodError e) {
+ }
+ List list = sps.stringList;
+ assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
+ assertMsgContains(list, 1, "Found binding in");
+ assertMsgContains(list, 2, "Found binding in");
+ assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
+ assertMsgContains(list, 4,
+ "slf4j-api 1.6.x (or later) is incompatible with this binding");
+ assertMsgContains(list, 5, "Your binding is version 1.5.5 or earlier.");
+
+ }
+
+ void assertMsgContains(List strList, int index, String msg) {
+ assertTrue(((String) strList.get(index)).contains(msg));
}
}
diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
index d8d0ad7..7787dce 100644
--- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
+++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java
@@ -44,8 +44,8 @@ class Log4jLoggerFactory {
String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL
+ " for more details.";
- Util.reportFailure(part1);
- Util.reportFailure(part2);
+ Util.report(part1);
+ Util.report(part2);
throw new IllegalStateException(part1 + part2);
} catch (ClassNotFoundException e) {
// this is the good case
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
index 8df4398..7d59d13 100644
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
+import org.slf4j.helpers.NOPLoggerFactory;
import org.slf4j.helpers.SubstituteLoggerFactory;
import org.slf4j.helpers.Util;
import org.slf4j.impl.StaticLoggerBinder;
@@ -68,13 +69,11 @@ public final class LoggerFactory {
static final int ONGOING_INITILIZATION = 1;
static final int FAILED_INITILIZATION = 2;
static final int SUCCESSFUL_INITILIZATION = 3;
-
- static final int GET_SINGLETON_INEXISTENT = 1;
- static final int GET_SINGLETON_EXISTS = 2;
+ static final int NOP_FALLBACK_INITILIZATION = 4;
static int INITIALIZATION_STATE = UNINITIALIZED;
- static int GET_SINGLETON_METHOD = UNINITIALIZED;
static SubstituteLoggerFactory TEMP_FACTORY = new SubstituteLoggerFactory();
+ static NOPLoggerFactory NOP_FALLBACK_FACTORY = new NOPLoggerFactory();
/**
* It is LoggerFactory's responsibility to track version changes and manage
@@ -83,7 +82,8 @@ public final class LoggerFactory {
* <p>
* It is assumed that all versions in the 1.6 are mutually compatible.
* */
- static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6", "2.0" };
+ static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6",
+ "2.0" };
// private constructor prevents instantiation
private LoggerFactory() {
@@ -102,55 +102,70 @@ public final class LoggerFactory {
*/
static void reset() {
INITIALIZATION_STATE = UNINITIALIZED;
- GET_SINGLETON_METHOD = UNINITIALIZED;
TEMP_FACTORY = new SubstituteLoggerFactory();
}
private final static void performInitialization() {
- bind();
- versionSanityCheck();
singleImplementationSanityCheck();
-
+ bind();
+ if (INITIALIZATION_STATE == SUCCESSFUL_INITILIZATION) {
+ versionSanityCheck();
+
+ }
}
private final static void bind() {
try {
// the next line does the binding
- getSingleton();
+ StaticLoggerBinder.getSingleton();
INITIALIZATION_STATE = SUCCESSFUL_INITILIZATION;
emitSubstituteLoggerWarning();
} catch (NoClassDefFoundError ncde) {
- INITIALIZATION_STATE = FAILED_INITILIZATION;
String msg = ncde.getMessage();
if (msg != null && msg.indexOf("org/slf4j/impl/StaticLoggerBinder") != -1) {
+ INITIALIZATION_STATE = NOP_FALLBACK_INITILIZATION;
Util
- .reportFailure("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
- Util.reportFailure("See " + NO_STATICLOGGERBINDER_URL
+ .report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
+ Util.report("Defaulting to no-operation (NOP) logger implementation");
+ Util.report("See " + NO_STATICLOGGERBINDER_URL
+ " for further details.");
-
+ } else {
+ failedBinding(ncde);
+ throw ncde;
}
- throw ncde;
+ } catch(java.lang.NoSuchMethodError nsme) {
+ String msg = nsme.getMessage();
+ if (msg != null && msg.indexOf("org.slf4j.impl.StaticLoggerBinder.getSingleton()") != -1) {
+ INITIALIZATION_STATE = FAILED_INITILIZATION;
+ Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding.");
+ Util.report("Your binding is version 1.5.5 or earlier.");
+ Util.report("Upgrade your binding to version 1.6.x. or 2.0.x");
+ }
+ throw nsme;
} catch (Exception e) {
- INITIALIZATION_STATE = FAILED_INITILIZATION;
- // we should never get here
- Util.reportFailure("Failed to instantiate logger ["
- + getSingleton().getLoggerFactoryClassStr() + "]", e);
+ failedBinding(e);
+ throw new IllegalStateException("Unexpected initialization failure", e);
}
}
+ static void failedBinding(Throwable t) {
+ INITIALIZATION_STATE = FAILED_INITILIZATION;
+ Util.report("Failed to instantiate SLF4J LoggerFactory", t);
+ }
+
private final static void emitSubstituteLoggerWarning() {
List loggerNameList = TEMP_FACTORY.getLoggerNameList();
if (loggerNameList.size() == 0) {
return;
}
Util
- .reportFailure("The following loggers will not work becasue they were created");
+ .report("The following loggers will not work becasue they were created");
Util
- .reportFailure("during the default configuration phase of the underlying logging system.");
- Util.reportFailure("See also " + SUBSTITUTE_LOGGER_URL);
+ .report("during the default configuration phase of the underlying logging system.");
+ Util.report("See also " + SUBSTITUTE_LOGGER_URL);
for (int i = 0; i < loggerNameList.size(); i++) {
String loggerName = (String) loggerNameList.get(i);
- Util.reportFailure(loggerName);
+ Util.report(loggerName);
}
}
@@ -165,10 +180,10 @@ public final class LoggerFactory {
}
}
if (!match) {
- Util.reportFailure("The requested version " + requested
+ Util.report("The requested version " + requested
+ " by your slf4j binding is not compatible with "
+ Arrays.asList(API_COMPATIBILITY_LIST).toString());
- Util.reportFailure("See " + VERSION_MISMATCH + " for further details.");
+ Util.report("See " + VERSION_MISMATCH + " for further details.");
}
} catch (java.lang.NoSuchFieldError nsfe) {
// given our large user base and SLF4J's commitment to backward
@@ -177,8 +192,7 @@ public final class LoggerFactory {
// emit compatibility warnings.
} catch (Throwable e) {
// we should never reach here
- Util.reportFailure(
- "Unexpected problem occured during version sanity check", e);
+ Util.report("Unexpected problem occured during version sanity check", e);
}
}
@@ -203,35 +217,14 @@ public final class LoggerFactory {
implementationList.add(path);
}
if (implementationList.size() > 1) {
- Util.reportFailure("Class path contains multiple SLF4J bindings.");
+ Util.report("Class path contains multiple SLF4J bindings.");
for (int i = 0; i < implementationList.size(); i++) {
- Util.reportFailure("Found binding in [" + implementationList.get(i)
- + "]");
+ Util.report("Found binding in [" + implementationList.get(i) + "]");
}
- Util.reportFailure("See " + MULTIPLE_BINDINGS_URL
- + " for an explanation.");
+ Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
}
} catch (IOException ioe) {
- Util.reportFailure("Error getting resources from path", ioe);
- }
- }
-
- private final static StaticLoggerBinder getSingleton() {
- if (GET_SINGLETON_METHOD == GET_SINGLETON_INEXISTENT) {
- return StaticLoggerBinder.getSingleton();
- }
-
- if (GET_SINGLETON_METHOD == GET_SINGLETON_EXISTS) {
- return StaticLoggerBinder.getSingleton();
- }
-
- try {
- StaticLoggerBinder singleton = StaticLoggerBinder.getSingleton();
- GET_SINGLETON_METHOD = GET_SINGLETON_EXISTS;
- return singleton;
- } catch (NoSuchMethodError nsme) {
- GET_SINGLETON_METHOD = GET_SINGLETON_INEXISTENT;
- return StaticLoggerBinder.getSingleton();
+ Util.report("Error getting resources from path", ioe);
}
}
@@ -276,7 +269,9 @@ public final class LoggerFactory {
}
switch (INITIALIZATION_STATE) {
case SUCCESSFUL_INITILIZATION:
- return getSingleton().getLoggerFactory();
+ return StaticLoggerBinder.getSingleton().getLoggerFactory();
+ case NOP_FALLBACK_INITILIZATION:
+ return NOP_FALLBACK_FACTORY;
case FAILED_INITILIZATION:
throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
case ONGOING_INITILIZATION:
diff --git a/slf4j-api/src/main/java/org/slf4j/MDC.java b/slf4j-api/src/main/java/org/slf4j/MDC.java
index f8d232d..1670061 100644
--- a/slf4j-api/src/main/java/org/slf4j/MDC.java
+++ b/slf4j-api/src/main/java/org/slf4j/MDC.java
@@ -27,6 +27,7 @@ package org.slf4j;
import java.util.Map;
import org.slf4j.helpers.BasicMDCAdapter;
+import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.helpers.Util;
import org.slf4j.impl.StaticMDCBinder;
import org.slf4j.spi.MDCAdapter;
@@ -39,13 +40,13 @@ import org.slf4j.spi.MDCAdapter;
* If the underlying logging system offers MDC functionality, then SLF4J's MDC,
* i.e. this class, will delegate to the underlying system's MDC. Note that at
* this time, only two logging systems, namely log4j and logback, offer MDC
- * functionality. If the underlying system does not support MDC, e.g. java.util.logging,
- * then SLF4J will use a {@link BasicMDCAdapter}.
+ * functionality. If the underlying system does not support MDC, e.g.
+ * java.util.logging, then SLF4J will use a {@link BasicMDCAdapter}.
*
* <p>
* Thus, as a SLF4J user, you can take advantage of MDC in the presence of log4j
- * logback, or java.util.logging, but without forcing these systems as dependencies
- * upon your users.
+ * logback, or java.util.logging, but without forcing these systems as
+ * dependencies upon your users.
*
* <p>
* For more information on MDC please see the <a
@@ -71,34 +72,36 @@ public class MDC {
try {
mdcAdapter = StaticMDCBinder.SINGLETON.getMDCA();
} catch (NoClassDefFoundError ncde) {
+ mdcAdapter = new NOPMDCAdapter();
String msg = ncde.getMessage();
if (msg != null && msg.indexOf("org/slf4j/impl/StaticMDCBinder") != -1) {
+ Util.report("Failed to load class \"org.slf4j.impl.StaticMDCBinder\".");
+ Util.report("Defaulting to no-operation MDCAdapter implementation.");
Util
- .reportFailure("Failed to load class \"org.slf4j.impl.StaticMDCBinder\".");
- Util.reportFailure("See " + NO_STATIC_MDC_BINDER_URL
- + " for further details.");
-
+ .report("See " + NO_STATIC_MDC_BINDER_URL + " for further details.");
+ } else {
+ throw ncde;
}
- throw ncde;
} catch (Exception e) {
// we should never get here
- Util.reportFailure("Could not bind with an instance of class ["
- + StaticMDCBinder.SINGLETON.getMDCAdapterClassStr() + "]", e);
+ Util.report("MDC binding unsuccessful.", e);
}
}
/**
- * Put a context value (the <code>val</code> parameter) as identified with
- * the <code>key</code> parameter into the current thread's context map.
- * The <code>key</code> parameter cannot be null. The <code>val</code> parameter
+ * Put a context value (the <code>val</code> parameter) as identified with the
+ * <code>key</code> parameter into the current thread's context map. The
+ * <code>key</code> parameter cannot be null. The <code>val</code> parameter
* can be null only if the underlying implementation supports it.
*
* <p>
* This method delegates all work to the MDC of the underlying logging system.
*
- * @throws IllegalArgumentException in case the "key" parameter is null
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
*/
- public static void put(String key, String val) throws IllegalArgumentException {
+ public static void put(String key, String val)
+ throws IllegalArgumentException {
if (key == null) {
throw new IllegalArgumentException("key parameter cannot be null");
}
@@ -110,19 +113,21 @@ public class MDC {
}
/**
- * Get the context identified by the <code>key</code> parameter. The
+ * Get the context identified by the <code>key</code> parameter. The
* <code>key</code> parameter cannot be null.
*
- * <p>This method delegates all work to the MDC of the underlying logging system.
+ * <p>
+ * This method delegates all work to the MDC of the underlying logging system.
*
* @return the string value identified by the <code>key</code> parameter.
- * @throws IllegalArgumentException in case the "key" parameter is null
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
*/
public static String get(String key) throws IllegalArgumentException {
if (key == null) {
throw new IllegalArgumentException("key parameter cannot be null");
}
-
+
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also "
+ NULL_MDCA_URL);
@@ -132,17 +137,18 @@ public class MDC {
/**
* Remove the the context identified by the <code>key</code> parameter using
- * the underlying system's MDC implementation. The <code>key</code> parameter
- * cannot be null. This method does nothing if there is no previous value
+ * the underlying system's MDC implementation. The <code>key</code> parameter
+ * cannot be null. This method does nothing if there is no previous value
* associated with <code>key</code>.
*
- * @throws IllegalArgumentException in case the "key" parameter is null
+ * @throws IllegalArgumentException
+ * in case the "key" parameter is null
*/
public static void remove(String key) throws IllegalArgumentException {
if (key == null) {
throw new IllegalArgumentException("key parameter cannot be null");
}
-
+
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also "
+ NULL_MDCA_URL);
@@ -150,7 +156,7 @@ public class MDC {
mdcAdapter.remove(key);
}
- /**
+ /**
* Clear all entries in the MDC of the underlying implementation.
*/
public static void clear() {
@@ -160,10 +166,10 @@ public class MDC {
}
mdcAdapter.clear();
}
-
+
/**
- * Return a copy of the current thread's context map, with keys and
- * values of type String. Returned value may be null.
+ * Return a copy of the current thread's context map, with keys and values of
+ * type String. Returned value may be null.
*
* @return A copy of the current thread's context map. May be null.
* @since 1.5.1
@@ -177,11 +183,12 @@ public class MDC {
}
/**
- * Set the current thread's context map by first clearing any existing
- * map and then copying the map passed as parameter. The context map passed
- * as parameter must only contain keys and values of type String.
+ * Set the current thread's context map by first clearing any existing map and
+ * then copying the map passed as parameter. The context map passed as
+ * parameter must only contain keys and values of type String.
*
- * @param contextMap must contain only keys and values of type String
+ * @param contextMap
+ * must contain only keys and values of type String
* @since 1.5.1
*/
public static void setContextMap(Map contextMap) {
@@ -191,8 +198,7 @@ public class MDC {
}
mdcAdapter.setContextMap(contextMap);
}
-
-
+
/**
* Returns the MDCAdapter instance currently in use.
*
@@ -202,6 +208,5 @@ public class MDC {
public static MDCAdapter getMDCAdapter() {
return mdcAdapter;
}
-
-
+
}
\ No newline at end of file
diff --git a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
index 271c4dd..3cb8cfc 100644
--- a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java
@@ -24,6 +24,7 @@
package org.slf4j;
+import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.helpers.Util;
import org.slf4j.impl.StaticMarkerBinder;
@@ -49,10 +50,12 @@ public class MarkerFactory {
static {
try {
markerFactory = StaticMarkerBinder.SINGLETON.getMarkerFactory();
+ } catch (NoClassDefFoundError e) {
+ markerFactory = new BasicMarkerFactory();
+
} catch (Exception e) {
// we should never get here
- Util.reportFailure("Could not instantiate instance of class ["
- + StaticMarkerBinder.SINGLETON.getMarkerFactoryClassStr() + "]", e);
+ Util.report("Unexpected failure while binding MarkerFactory", e);
}
}
diff --git a/slf4j-nop/src/main/java/org/slf4j/impl/NOPLoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/helpers/NOPLoggerFactory.java
similarity index 98%
rename from slf4j-nop/src/main/java/org/slf4j/impl/NOPLoggerFactory.java
rename to slf4j-api/src/main/java/org/slf4j/helpers/NOPLoggerFactory.java
index c63331c..cff1a47 100644
--- a/slf4j-nop/src/main/java/org/slf4j/impl/NOPLoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/NOPLoggerFactory.java
@@ -31,7 +31,7 @@
*
*/
-package org.slf4j.impl;
+package org.slf4j.helpers;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/NOPMakerAdapter.java b/slf4j-api/src/main/java/org/slf4j/helpers/NOPMDCAdapter.java
similarity index 92%
rename from slf4j-api/src/main/java/org/slf4j/helpers/NOPMakerAdapter.java
rename to slf4j-api/src/main/java/org/slf4j/helpers/NOPMDCAdapter.java
index ab85753..b995cba 100644
--- a/slf4j-api/src/main/java/org/slf4j/helpers/NOPMakerAdapter.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/NOPMDCAdapter.java
@@ -13,7 +13,7 @@ import org.slf4j.spi.MDCAdapter;
*
* @since 1.4.1
*/
-public class NOPMakerAdapter implements MDCAdapter {
+public class NOPMDCAdapter implements MDCAdapter {
public void clear() {
}
diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/Util.java b/slf4j-api/src/main/java/org/slf4j/helpers/Util.java
index 1ce0f97..1af1224 100644
--- a/slf4j-api/src/main/java/org/slf4j/helpers/Util.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/Util.java
@@ -33,13 +33,13 @@ package org.slf4j.helpers;
*/
public class Util {
- static final public void reportFailure(String msg, Throwable t) {
+ static final public void report(String msg, Throwable t) {
System.err.println(msg);
System.err.println("Reported exception:");
t.printStackTrace();
}
- static final public void reportFailure(String msg) {
+ static final public void report(String msg) {
System.err.println("SLF4J: " +msg);
}
}
diff --git a/slf4j-api/src/test/java/org/slf4j/NoBindingTest.java b/slf4j-api/src/test/java/org/slf4j/NoBindingTest.java
index e906513..89136e8 100644
--- a/slf4j-api/src/test/java/org/slf4j/NoBindingTest.java
+++ b/slf4j-api/src/test/java/org/slf4j/NoBindingTest.java
@@ -1,25 +1,50 @@
+/*
+ * Copyright (c) 2004-2010 QOS.ch All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
package org.slf4j;
+import java.util.Random;
+
+import org.slf4j.helpers.BasicMarker;
+import org.slf4j.helpers.NOPLogger;
+
import junit.framework.TestCase;
public class NoBindingTest extends TestCase {
+ int diff = new Random().nextInt(10000);
+
public void testLogger() {
- try {
- Logger logger = LoggerFactory.getLogger(NoBindingTest.class);
- logger.debug("hello");
- fail("slf4j-api does not ship with a binding");
- } catch (NoClassDefFoundError e) {
-
- }
+ Logger logger = LoggerFactory.getLogger(NoBindingTest.class);
+ logger.debug("hello"+diff);
+ assertTrue(logger instanceof NOPLogger);
}
public void testMDC() {
- try {
- MDC.put("k", "v");
- fail("slf4j-api does not ship with a binding");
- } catch (NoClassDefFoundError e) {
+ MDC.put("k"+diff, "v");
+ assertNull(MDC.get("k"));
+ }
- }
+ public void testMarker() {
+ Marker m = MarkerFactory.getMarker("a"+diff);
+ assertTrue(m instanceof BasicMarker);
}
}
diff --git a/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerFactory.java b/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerFactory.java
index c3ce664..17a5f63 100644
--- a/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerFactory.java
+++ b/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerFactory.java
@@ -59,8 +59,8 @@ public class JCLLoggerFactory implements ILoggerFactory {
String part2 = "See also " + JCL_DELEGATION_LOOP_URL
+ " for more details.";
- Util.reportFailure(part1);
- Util.reportFailure(part2);
+ Util.report(part1);
+ Util.report(part2);
throw new IllegalStateException(part1 + part2);
} catch (ClassNotFoundException e) {
// this is the good case
diff --git a/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index 0b9fb17..9630a24 100644
--- a/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -1,11 +1,11 @@
package org.slf4j.impl;
-import org.slf4j.helpers.NOPMakerAdapter;
+import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.spi.MDCAdapter;
/**
- * This implementation is bound to {@link NOPMakerAdapter}.
+ * This implementation is bound to {@link NOPMDCAdapter}.
*
* @author Ceki Gülcü
*/
@@ -25,10 +25,10 @@ public class StaticMDCBinder {
* {@link StaticMDCBinder}.
*/
public MDCAdapter getMDCA() {
- return new NOPMakerAdapter();
+ return new NOPMDCAdapter();
}
public String getMDCAdapterClassStr() {
- return NOPMakerAdapter.class.getName();
+ return NOPMDCAdapter.class.getName();
}
}
diff --git a/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 37487de..8b6af97 100644
--- a/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -83,7 +83,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
Level level = Level.TRACE;
} catch (NoSuchFieldError nsfe) {
Util
- .reportFailure("This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version");
+ .report("This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version");
}
}
diff --git a/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index ef15ec3..779ad1c 100644
--- a/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -35,6 +35,7 @@ package org.slf4j.impl;
import org.slf4j.ILoggerFactory;
import org.slf4j.LoggerFactory;
+import org.slf4j.helpers.NOPLoggerFactory;
import org.slf4j.spi.LoggerFactoryBinder;
/**
diff --git a/slf4j-nop/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-nop/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index 0b9fb17..9630a24 100644
--- a/slf4j-nop/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/slf4j-nop/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -1,11 +1,11 @@
package org.slf4j.impl;
-import org.slf4j.helpers.NOPMakerAdapter;
+import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.spi.MDCAdapter;
/**
- * This implementation is bound to {@link NOPMakerAdapter}.
+ * This implementation is bound to {@link NOPMDCAdapter}.
*
* @author Ceki Gülcü
*/
@@ -25,10 +25,10 @@ public class StaticMDCBinder {
* {@link StaticMDCBinder}.
*/
public MDCAdapter getMDCA() {
- return new NOPMakerAdapter();
+ return new NOPMDCAdapter();
}
public String getMDCAdapterClassStr() {
- return NOPMakerAdapter.class.getName();
+ return NOPMDCAdapter.class.getName();
}
}
diff --git a/slf4j-simple/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-simple/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index a06185e..e4abdbe 100644
--- a/slf4j-simple/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/slf4j-simple/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -24,12 +24,12 @@
package org.slf4j.impl;
-import org.slf4j.helpers.NOPMakerAdapter;
+import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.spi.MDCAdapter;
/**
- * This implementation is bound to {@link NOPMakerAdapter}.
+ * This implementation is bound to {@link NOPMDCAdapter}.
*
* @author Ceki Gülcü
*/
@@ -49,10 +49,10 @@ public class StaticMDCBinder {
* {@link StaticMDCBinder}.
*/
public MDCAdapter getMDCA() {
- return new NOPMakerAdapter();
+ return new NOPMDCAdapter();
}
public String getMDCAdapterClassStr() {
- return NOPMakerAdapter.class.getName();
+ return NOPMDCAdapter.class.getName();
}
}
diff --git a/slf4j-site/src/site/pages/codes.html b/slf4j-site/src/site/pages/codes.html
index f5d7ed2..ff2281c 100644
--- a/slf4j-site/src/site/pages/codes.html
+++ b/slf4j-site/src/site/pages/codes.html
@@ -103,6 +103,10 @@
problem.
</p>
+ <p>As of SLF4J version 1.6, in the absence of a binding, SLF4J
+ will default to a no-operation (NOP) logger implementation.
+ </p>
+
<p>You can download SLF4J bindings from the project <a
href="http://www.slf4j.org/download.html">download page</a>. </p>
diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html
index aad3d9f..84881c6 100644
--- a/slf4j-site/src/site/pages/faq.html
+++ b/slf4j-site/src/site/pages/faq.html
@@ -531,8 +531,8 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
to wrap SLF4J and link with it only if it is already present on
the classpath, making SLF4J an optional dependency of Wombat. In
addition to solving the dependency problem, the wrapper will
- isolate Wombat from SLF4J;s API ensuring that logging in Wombat
- is future-proof.
+ isolate Wombat from SLF4J's API ensuring that logging in Wombat
+ is future-proof.
</p>
<p>On the other hand, any SLF4J-wrapper by definition depends on
@@ -542,7 +542,17 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
migrate to the new API as code that used SLF4J directly. Thus,
the wrapper is not likely to future-proof your code, but to make
it heavier by adding an additional indirection on top SLF4J
- which is an indirection in itself.
+ which is an indirection in itself. It's actually a lot worse
+ than that. Wrappers will need to depend on certain internal
+ SLF4J interfaces which change from time to time, typical on each
+ major series, contrary to the client-facing API which never
+ changes. Thus, wrappers are usually dependent on the major
+ version they were compiled with. A wrapper compiled against
+ SLF4J version 1.5.x will not work with SLF4J 1.6 whereas client
+ code using <code>org.slf4j.Logger</code>,
+ <code>LoggerFactory</code>, <code>MarkerFactory</code>,
+ <code>org.slf4j.Marker</code>, and <code>MDC</code> will work
+ fine with any SLF4J version from version 1.0 and onwards.
</p>
<p>It is reasonable to assume that in most projects Wombat will
@@ -573,7 +583,8 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
<p>For the above reasons, developers of frameworks should resist
the temptation to write their own logging wrapper. Not only is
it a waste of time of the developer, it will actually make life
- more difficult for the users of said frameworks.
+ more difficult for the users of said frameworks and make logging
+ code paradoxically more vulnerable to change.
</p>
</dd>
@@ -616,6 +627,11 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
any SLF4J-binding or any underlying logging system.
</p>
+ <p>Note that as of SLF4J version 1.6, in the absence of an SLF4J
+ binding, slf4j-api will default to a no-operation
+ implementation.
+ </p>
+
<hr/>
</dd>
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 0385121..7ff7bab 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -32,7 +32,15 @@
<p>It is expected that <em>all</em> SLF4J releases in the 1.6.x and
2.0.x series will be mutually compatible. Note that the 2.0.x
series is expected to require JDK 1.5 or later.
- </p>
+ </p>
+
+ <p>Note that as of SLF4J version 1.6.0, in the absence of an SLF4J
+ binding, slf4j-api will default to a no-operation implementation
+ discarding all log requests. Thus, instead of throwing an
+ exception, SLF4J will emit a single warning message about the
+ absence of a binding and proceed to discard all log requests
+ without further protest.
+ </p>
<p>Fixed <a
href="http://bugzilla.slf4j.org/show_bug.cgi?id=150">bug 150</a> by
-----------------------------------------------------------------------
Summary of changes:
integration/build.xml | 57 ++++++-----
...f4j-simple-1.5.0.jar => slf4j-simple-1.4.2.jar} | Bin 7477 -> 7470 bytes
integration/lib/slf4j-simple-INCOMPATIBLE.jar | Bin 7478 -> 0 bytes
...va => MissingSingletonMethodAssertionTest.java} | 45 +++++++--
.../java/org/slf4j/MultiBindingAssertionTest.java | 29 ++++--
.../java/org/apache/log4j/Log4jLoggerFactory.java | 4 +-
.../src/main/java/org/slf4j/LoggerFactory.java | 101 +++++++++----------
slf4j-api/src/main/java/org/slf4j/MDC.java | 77 ++++++++-------
.../src/main/java/org/slf4j/MarkerFactory.java | 7 +-
.../java/org/slf4j/helpers}/NOPLoggerFactory.java | 2 +-
.../{NOPMakerAdapter.java => NOPMDCAdapter.java} | 2 +-
.../src/main/java/org/slf4j/helpers/Util.java | 4 +-
.../src/test/java/org/slf4j/NoBindingTest.java | 49 +++++++---
.../main/java/org/slf4j/impl/JCLLoggerFactory.java | 4 +-
.../main/java/org/slf4j/impl/StaticMDCBinder.java | 8 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 1 +
.../main/java/org/slf4j/impl/StaticMDCBinder.java | 8 +-
.../main/java/org/slf4j/impl/StaticMDCBinder.java | 8 +-
slf4j-site/src/site/pages/codes.html | 4 +
slf4j-site/src/site/pages/faq.html | 24 ++++-
slf4j-site/src/site/pages/news.html | 10 ++-
22 files changed, 274 insertions(+), 172 deletions(-)
copy integration/lib/{slf4j-simple-1.5.0.jar => slf4j-simple-1.4.2.jar} (54%)
delete mode 100644 integration/lib/slf4j-simple-INCOMPATIBLE.jar
copy integration/src/test/java/org/slf4j/{MultiBindingAssertionTest.java => MissingSingletonMethodAssertionTest.java} (59%)
rename {slf4j-nop/src/main/java/org/slf4j/impl => slf4j-api/src/main/java/org/slf4j/helpers}/NOPLoggerFactory.java (98%)
rename slf4j-api/src/main/java/org/slf4j/helpers/{NOPMakerAdapter.java => NOPMDCAdapter.java} (92%)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-9-ga19566c
by git-noreply@pixie.qos.ch 05 Apr '10
by git-noreply@pixie.qos.ch 05 Apr '10
05 Apr '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via a19566c1e0752a651057279e80384ef5ac37dfae (commit)
from 581b20f8aaa140ce722669a2cf1d8582a963ff4e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=a19566c1e0752a651057279e80…
http://github.com/ceki/slf4j/commit/a19566c1e0752a651057279e80384ef5ac37dfae
commit a19566c1e0752a651057279e80384ef5ac37dfae
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Apr 5 19:03:04 2010 +0200
- the SINGLETON field in StaticLoggerBinder is now private
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
index 96858a9..8df4398 100644
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -218,7 +218,7 @@ public final class LoggerFactory {
private final static StaticLoggerBinder getSingleton() {
if (GET_SINGLETON_METHOD == GET_SINGLETON_INEXISTENT) {
- return StaticLoggerBinder.SINGLETON;
+ return StaticLoggerBinder.getSingleton();
}
if (GET_SINGLETON_METHOD == GET_SINGLETON_EXISTS) {
@@ -231,7 +231,7 @@ public final class LoggerFactory {
return singleton;
} catch (NoSuchMethodError nsme) {
GET_SINGLETON_METHOD = GET_SINGLETON_INEXISTENT;
- return StaticLoggerBinder.SINGLETON;
+ return StaticLoggerBinder.getSingleton();
}
}
diff --git a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 672058e..5f1c2b7 100644
--- a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -40,12 +40,8 @@ public class StaticLoggerBinder {
/**
* The unique instance of this class.
- *
- * @deprecated Please use the {@link #getSingleton()} method instead of
- * accessing this field directly. In future versions, this field
- * will become private.
*/
- public static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+ private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
/**
* Return the singleton of this class.
-----------------------------------------------------------------------
Summary of changes:
.../src/main/java/org/slf4j/LoggerFactory.java | 4 ++--
.../java/org/slf4j/impl/StaticLoggerBinder.java | 6 +-----
2 files changed, 3 insertions(+), 7 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[Bug 171] New: OSGi: Add an Import-Package to log4j-overslf4j's MANIFEST.MF
by bugzilla-daemon@pixie.qos.ch 05 Apr '10
by bugzilla-daemon@pixie.qos.ch 05 Apr '10
05 Apr '10
http://bugzilla.slf4j.org/show_bug.cgi?id=171
Summary: OSGi: Add an Import-Package to log4j-overslf4j's
MANIFEST.MF
Product: SLF4J
Version: 1.5.x
Platform: PC
OS/Version: Linux
Status: NEW
Severity: blocker
Priority: P1
Component: log4j-over-slf4j
AssignedTo: slf4j-dev(a)qos.ch
ReportedBy: hmalphettes(a)intalio.com
Hi,
while working on http://bugzilla.slf4j.org/show_bug.cgi?id=170
I noticed that org.apache.log4j.Log4jLoggerFactory requires
org.slf4j.helpers.Util
It should be added to log4j-over-slf4j's MANIFEST as an Import-Package:
The difference is at the very end of:
http://github.com/hmalphettes/slf4j/commit/2d30df3bd74e920d505308b322579d6f…
log4j-over-slf4j/src/main/resources/META-INF/MANIFEST.MF
@@ -3,4 +3,4 @@ Bundle-SymbolicName: log4j.over.slf4j
Bundle-Name: log4j-over-slf4j
Export-Package: org.apache.log4j
-Import-Package: org.slf4j, org.slf4j.spi
+Import-Package: org.slf4j, org.slf4j.helpers, org.slf4j.sp
Thanks!
Hugues
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
2

04 Apr '10
http://bugzilla.slf4j.org/show_bug.cgi?id=154
Ceki Gulcu <lists(a)slf4j.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #1 from Ceki Gulcu <lists(a)slf4j.org> 2010-04-05 00:13:17 ---
Fixed in http://github.com/ceki/slf4j/commit/581b20f8a
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
0

[GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-8-g581b20f
by git-noreply@pixie.qos.ch 04 Apr '10
by git-noreply@pixie.qos.ch 04 Apr '10
04 Apr '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 581b20f8aaa140ce722669a2cf1d8582a963ff4e (commit)
from 40e51c6d8ce73c4b7822596288039a6c7fd1e00f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=581b20f8aaa140ce722669a2cf…
http://github.com/ceki/slf4j/commit/581b20f8aaa140ce722669a2cf1d8582a963ff4e
commit 581b20f8aaa140ce722669a2cf1d8582a963ff4e
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Apr 5 00:11:16 2010 +0200
- fixed bug 154
- It is expected that all SLF4J releases in the 1.6.x and 2.0.x series
will be mutually compatible. Note that the 2.0.x series is expected to
require JDK 1.5 or later.
diff --git a/integration/build.xml b/integration/build.xml
index 41b55d4..d4e88a6 100644
--- a/integration/build.xml
+++ b/integration/build.xml
@@ -15,21 +15,33 @@
<echo message="plugin classpath: ${plugin_classpath}" />
<path id="path150">
- <pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
</path >
+
+ <path id="path1511API">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="./lib/slf4j-api-1.5.11.jar" />
+ <pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
+ </path >
+
+ <path id="path1511Binding">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-simple-1.5.11.jar" />
+ </path >
+
+
+
<path id="pathIncompatible">
- <pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-INCOMPATIBLE.jar" />
</path >
<path id="pathCurrent">
- <pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
@@ -37,13 +49,47 @@
<path id="multiBinding">
- <pathelement location="xtarget/classes/" />
<pathelement location="target/test-classes/" />
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
</path >
+
+ <path id="multiBinding">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-simple-1.5.0.jar" />
+ <pathelement location="./lib/slf4j-nop-1.5.6.jar" />
+ </path >
+
+
+ <path id="binding1699">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-simple-1.6.99.jar" />
+ </path >
+
+ <path id="binding2099">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-simple-2.0.99.jar" />
+ </path >
+
+
+ <path id="api1699">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-api-1.6.99.jar" />
+ </path >
+
+ <path id="api2099">
+ <pathelement location="target/test-classes/" />
+ <pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
+ <pathelement location="./lib/slf4j-api-2.0.99.jar" />
+ </path >
+
+
<!-- this is really very ugly, but it's the only way to circumvent
http://jira.codehaus.org/browse/MANTRUN-95
-->
@@ -57,23 +103,48 @@
<target name="testAll" depends="init,
testMismatch,
testPre155,
- testMatch,
- testMultiBinding">
+ testMatch,
+ testMultiBinding,
+ testFuture_16Series">
</target>
<target name="testMismatch">
+
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="pathIncompatible" />
<formatter type="plain" />
- <test fork="yes" todir="target/unit-reports" name="org.slf4j.VersionMismatchTest" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-INCOMPATIBLE"
+ name="org.slf4j.VersionMismatchAssertionTest" />
+ </junit>
+
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="path1511API" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-MISMATCH-1511API"
+ name="org.slf4j.VersionMismatchAssertionTest" />
+ </junit>
+
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="path1511Binding" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-MISMATCH-1511Binding"
+ name="org.slf4j.VersionMismatchAssertionTest" />
</junit>
+
</target>
<target name="testPre155">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="path150" />
<formatter type="plain" />
- <test fork="yes" todir="target/unit-reports" name="org.slf4j.Pre155VersionTest" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-testPre155"
+ name="org.slf4j.CompatibilityAssertionTest" />
</junit>
</target>
@@ -81,7 +152,9 @@
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="pathCurrent" />
<formatter type="plain" />
- <test fork="yes" todir="target/unit-reports" name="org.slf4j.VersionMatchTest" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-Match"
+ name="org.slf4j.CompatibilityAssertionTest" />
</junit>
</target>
@@ -89,7 +162,44 @@
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath refid="multiBinding" />
<formatter type="plain" />
- <test fork="yes" todir="target/unit-reports" name="org.slf4j.MultiBindingTest" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-MultiBinding"
+ name="org.slf4j.MultiBindingAssertionTest" />
+ </junit>
+ </target>
+
+ <target name="testFuture_16Series">
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="binding1699" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-_binding1699"
+ name="org.slf4j.CompatibilityAssertionTest" />
</junit>
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="binding2099" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-_binding2099"
+ name="org.slf4j.CompatibilityAssertionTest" />
+ </junit>
+
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="api1699" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-api1699"
+ name="org.slf4j.CompatibilityAssertionTest" />
+ </junit>
+
+ <junit printsummary="yes" fork="no" haltonfailure="yes">
+ <classpath refid="api2099" />
+ <formatter type="plain" />
+ <test fork="yes" todir="target/unit-reports"
+ outfile="TEST-api2099"
+ name="org.slf4j.CompatibilityAssertionTest" />
+ </junit>
</target>
</project>
\ No newline at end of file
diff --git a/integration/lib/slf4j-api-1.5.11.jar b/integration/lib/slf4j-api-1.5.11.jar
new file mode 100644
index 0000000..ccb8c72
Binary files /dev/null and b/integration/lib/slf4j-api-1.5.11.jar differ
diff --git a/integration/lib/slf4j-api-1.6.99.jar b/integration/lib/slf4j-api-1.6.99.jar
new file mode 100644
index 0000000..a862fba
Binary files /dev/null and b/integration/lib/slf4j-api-1.6.99.jar differ
diff --git a/integration/lib/slf4j-api-2.0.99.jar b/integration/lib/slf4j-api-2.0.99.jar
new file mode 100644
index 0000000..496af27
Binary files /dev/null and b/integration/lib/slf4j-api-2.0.99.jar differ
diff --git a/integration/lib/slf4j-simple-1.5.11.jar b/integration/lib/slf4j-simple-1.5.11.jar
new file mode 100644
index 0000000..598410e
Binary files /dev/null and b/integration/lib/slf4j-simple-1.5.11.jar differ
diff --git a/integration/lib/slf4j-simple-1.6.99.jar b/integration/lib/slf4j-simple-1.6.99.jar
new file mode 100644
index 0000000..74707fe
Binary files /dev/null and b/integration/lib/slf4j-simple-1.6.99.jar differ
diff --git a/integration/lib/slf4j-simple-2.0.99.jar b/integration/lib/slf4j-simple-2.0.99.jar
new file mode 100644
index 0000000..996bceb
Binary files /dev/null and b/integration/lib/slf4j-simple-2.0.99.jar differ
diff --git a/integration/src/test/java/org/slf4j/VersionMatchTest.java b/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
similarity index 87%
rename from integration/src/test/java/org/slf4j/VersionMatchTest.java
rename to integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
index 4b7a075..555a597 100644
--- a/integration/src/test/java/org/slf4j/VersionMatchTest.java
+++ b/integration/src/test/java/org/slf4j/CompatibilityAssertionTest.java
@@ -6,14 +6,13 @@ import java.util.Random;
import junit.framework.TestCase;
-public class VersionMatchTest extends TestCase {
+public class CompatibilityAssertionTest extends TestCase {
-
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
- public VersionMatchTest(String name) {
+ public CompatibilityAssertionTest(String name) {
super(name);
}
diff --git a/integration/src/test/java/org/slf4j/MultiBindingTest.java b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
similarity index 95%
rename from integration/src/test/java/org/slf4j/MultiBindingTest.java
rename to integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
index 3f33c3e..daa81f9 100644
--- a/integration/src/test/java/org/slf4j/MultiBindingTest.java
+++ b/integration/src/test/java/org/slf4j/MultiBindingAssertionTest.java
@@ -29,13 +29,13 @@ import java.util.Random;
import junit.framework.TestCase;
-public class MultiBindingTest extends TestCase {
+public class MultiBindingAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
- public MultiBindingTest(String name) {
+ public MultiBindingAssertionTest(String name) {
super(name);
}
diff --git a/integration/src/test/java/org/slf4j/Pre155VersionTest.java b/integration/src/test/java/org/slf4j/Pre155VersionTest.java
deleted file mode 100644
index 02dc11e..0000000
--- a/integration/src/test/java/org/slf4j/Pre155VersionTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2004-2009 QOS.ch
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package org.slf4j;
-
-import java.io.PrintStream;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-public class Pre155VersionTest extends TestCase {
-
- StringPrintStream sps = new StringPrintStream(System.err);
- PrintStream old = System.err;
- int diff = 1024 + new Random().nextInt(10000);
-
- public Pre155VersionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- System.setErr(sps);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- System.setErr(old);
- }
-
- public void test() throws Exception {
- Logger logger = LoggerFactory.getLogger(this.getClass());
- String msg = "hello world " + diff;
- logger.info(msg);
- String s0 = (String) sps.stringList.get(0);
- assertTrue(s0.contains(msg));
- }
-}
diff --git a/integration/src/test/java/org/slf4j/VersionMismatchTest.java b/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
similarity index 89%
rename from integration/src/test/java/org/slf4j/VersionMismatchTest.java
rename to integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
index d325866..663428e 100644
--- a/integration/src/test/java/org/slf4j/VersionMismatchTest.java
+++ b/integration/src/test/java/org/slf4j/VersionMismatchAssertionTest.java
@@ -5,13 +5,13 @@ import java.util.Random;
import junit.framework.TestCase;
-public class VersionMismatchTest extends TestCase {
+public class VersionMismatchAssertionTest extends TestCase {
StringPrintStream sps = new StringPrintStream(System.err);
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
- public VersionMismatchTest(String name) {
+ public VersionMismatchAssertionTest(String name) {
super(name);
}
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
index 2f5c2f3..96858a9 100644
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -81,11 +81,9 @@ public final class LoggerFactory {
* the compatibility list.
*
* <p>
- * It is assumed that qualifiers after the 3rd digit have no impact on
- * compatibility. Thus, 1.5.7-SNAPSHOT, 1.5.7.RC0 are compatible with 1.5.7.
- */
- static private final String[] API_COMPATIBILITY_LIST = new String[] {
- "1.5.5", "1.5.6", "1.5.7", "1.5.8", "1.5.9", "1.5.10", "1.5.11" };
+ * It is assumed that all versions in the 1.6 are mutually compatible.
+ * */
+ static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.6", "2.0" };
// private constructor prevents instantiation
private LoggerFactory() {
@@ -196,7 +194,8 @@ public final class LoggerFactory {
if (loggerFactoryClassLoader == null) {
paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
} else {
- paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
+ paths = loggerFactoryClassLoader
+ .getResources(STATIC_LOGGER_BINDER_PATH);
}
List implementationList = new ArrayList();
while (paths.hasMoreElements()) {
diff --git a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 169b747..672058e 100644
--- a/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-api/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -61,7 +61,7 @@ public class StaticLoggerBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11"; // !final
+ public static String REQUESTED_API_VERSION = "1.6"; // !final
private StaticLoggerBinder() {
throw new UnsupportedOperationException("This code should have never made it into the jar");
diff --git a/slf4j-jcl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-jcl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 9fea2be..56981b0 100644
--- a/slf4j-jcl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-jcl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -65,7 +65,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
*/
//to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11";
+ public static String REQUESTED_API_VERSION = "1.6";
// Binding specific code:
private static final String loggerFactoryClassStr = JCLLoggerFactory.class
diff --git a/slf4j-jdk14/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-jdk14/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 92e9db8..47afb3f 100644
--- a/slf4j-jdk14/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-jdk14/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11"; // !final
+ public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = org.slf4j.impl.JDK14LoggerFactory.class.getName();
diff --git a/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 2e86c52..37487de 100644
--- a/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-log4j12/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* against. The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11"; // !final
+ public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = Log4jLoggerFactory.class
.getName();
diff --git a/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 4c14792..ef15ec3 100644
--- a/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-nop/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -66,7 +66,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11"; // !final
+ public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = NOPLoggerFactory.class.getName();
diff --git a/slf4j-simple/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-simple/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index 064cb9e..51370cb 100644
--- a/slf4j-simple/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/slf4j-simple/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -58,7 +58,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
* against. The value of this field is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
- public static String REQUESTED_API_VERSION = "1.5.11"; // !final
+ public static String REQUESTED_API_VERSION = "1.6"; // !final
private static final String loggerFactoryClassStr = SimpleLoggerFactory.class.getName();
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 8279131..0385121 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,6 +29,11 @@
<h3>April Xth, 2010 - Release of SLF4J 1.6.0</h3>
+ <p>It is expected that <em>all</em> SLF4J releases in the 1.6.x and
+ 2.0.x series will be mutually compatible. Note that the 2.0.x
+ series is expected to require JDK 1.5 or later.
+ </p>
+
<p>Fixed <a
href="http://bugzilla.slf4j.org/show_bug.cgi?id=150">bug 150</a> by
implementing missing <code>resetConfiguration()</code> and
-----------------------------------------------------------------------
Summary of changes:
integration/build.xml | 130 ++++++++++++++++++--
integration/lib/slf4j-api-1.5.11.jar | Bin 0 -> 23671 bytes
integration/lib/slf4j-api-1.6.99.jar | Bin 0 -> 23757 bytes
integration/lib/slf4j-api-2.0.99.jar | Bin 0 -> 23759 bytes
integration/lib/slf4j-simple-1.5.11.jar | Bin 0 -> 7600 bytes
integration/lib/slf4j-simple-1.6.99.jar | Bin 0 -> 7602 bytes
integration/lib/slf4j-simple-2.0.99.jar | Bin 0 -> 7603 bytes
...chTest.java => CompatibilityAssertionTest.java} | 5 +-
...ingTest.java => MultiBindingAssertionTest.java} | 4 +-
.../src/test/java/org/slf4j/Pre155VersionTest.java | 59 ---------
...Test.java => VersionMismatchAssertionTest.java} | 4 +-
.../src/main/java/org/slf4j/LoggerFactory.java | 11 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
.../java/org/slf4j/impl/StaticLoggerBinder.java | 2 +-
slf4j-site/src/site/pages/news.html | 5 +
19 files changed, 142 insertions(+), 88 deletions(-)
create mode 100644 integration/lib/slf4j-api-1.5.11.jar
create mode 100644 integration/lib/slf4j-api-1.6.99.jar
create mode 100644 integration/lib/slf4j-api-2.0.99.jar
create mode 100644 integration/lib/slf4j-simple-1.5.11.jar
create mode 100644 integration/lib/slf4j-simple-1.6.99.jar
create mode 100644 integration/lib/slf4j-simple-2.0.99.jar
rename integration/src/test/java/org/slf4j/{VersionMatchTest.java => CompatibilityAssertionTest.java} (87%)
rename integration/src/test/java/org/slf4j/{MultiBindingTest.java => MultiBindingAssertionTest.java} (95%)
delete mode 100644 integration/src/test/java/org/slf4j/Pre155VersionTest.java
rename integration/src/test/java/org/slf4j/{VersionMismatchTest.java => VersionMismatchAssertionTest.java} (89%)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0

[Bug 164] New: NPE on LoggerFactory.singleImplementationSanityCheck
by bugzilla-daemon@pixie.qos.ch 04 Apr '10
by bugzilla-daemon@pixie.qos.ch 04 Apr '10
04 Apr '10
http://bugzilla.slf4j.org/show_bug.cgi?id=164
Summary: NPE on LoggerFactory.singleImplementationSanityCheck
Product: SLF4J
Version: 1.5.x
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P1
Component: Core API
AssignedTo: slf4j-dev(a)qos.ch
ReportedBy: joakim.erdfelt(a)gmail.com
This occurs on slf4j-api 1.5.7 and 1.5.8 when using logback 0.9.18
It does not occur on slf4j-api 1.5.6
Note: the environment being used has various java.endorsed.dirs setup where the
logging is initialized. This being not very normal, it could be the reason for
this NPE, as I believe LoggerFactory.class.getClassLoader() will return null in
this scenario.
java.lang.NullPointerException
at
org.slf4j.LoggerFactory.singleImplementationSanityCheck(LoggerFactory.java:192)
at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:113)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:33)
at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:28)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
1
3

[GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-7-g40e51c6
by git-noreply@pixie.qos.ch 04 Apr '10
by git-noreply@pixie.qos.ch 04 Apr '10
04 Apr '10
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via 40e51c6d8ce73c4b7822596288039a6c7fd1e00f (commit)
from 6f819965012916a03ec7bffd6ddcb16164da94ec (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=40e51c6d8ce73c4b7822596288…
http://github.com/ceki/slf4j/commit/40e51c6d8ce73c4b7822596288039a6c7fd1e00f
commit 40e51c6d8ce73c4b7822596288039a6c7fd1e00f
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Sun Apr 4 22:20:26 2010 +0200
Fixed bug 164 observed when SLF4J artifacts were placed under
java.endorsed.dirs.
diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
index 068d3df..2f5c2f3 100644
--- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
+++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
@@ -192,12 +192,12 @@ public final class LoggerFactory {
try {
ClassLoader loggerFactoryClassLoader = LoggerFactory.class
.getClassLoader();
+ Enumeration paths;
if (loggerFactoryClassLoader == null) {
- // see http://bugzilla.slf4j.org/show_bug.cgi?id=146
- return; // better than a null pointer exception
+ paths = ClassLoader.getSystemResources(STATIC_LOGGER_BINDER_PATH);
+ } else {
+ paths = loggerFactoryClassLoader.getResources(STATIC_LOGGER_BINDER_PATH);
}
- Enumeration paths = loggerFactoryClassLoader
- .getResources(STATIC_LOGGER_BINDER_PATH);
List implementationList = new ArrayList();
while (paths.hasMoreElements()) {
URL path = (URL) paths.nextElement();
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index e37db4a..8279131 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -48,6 +48,12 @@
href="http://bugzilla.slf4j.org/show_bug.cgi?id=175">bug 175</a> by
synchronizing access to the loggerNameList field.</p>
+ <p>Fixed <a
+ href="http://bugzilla.slf4j.org/show_bug.cgi?id=164">bug 164</a>
+ observed when SLF4J artifacts were placed under
+ java.endorsed.dirs.</p>
+
+
<hr noshade="noshade" size="1"/>
<h3>February 25th, 2010 - Release of SLF4J 1.5.11</h3>
-----------------------------------------------------------------------
Summary of changes:
.../src/main/java/org/slf4j/LoggerFactory.java | 8 ++++----
slf4j-site/src/site/pages/news.html | 6 ++++++
2 files changed, 10 insertions(+), 4 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
1
0