Author: ceki
Date: Thu Dec 8 12:17:52 2005
New Revision: 452
Removed:
nlog4j/trunk/src/java/org/slf4j/Marker.java
nlog4j/trunk/src/java/org/slf4j/MarkerFactory.java
nlog4j/trunk/src/java/org/slf4j/MarkingLogger.java
Modified:
nlog4j/trunk/build.properties
nlog4j/trunk/slf4j.xml
nlog4j/trunk/src/java/org/apache/log4j/Logger.java
nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java
nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
nlog4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFactory.java
nlog4j/trunk/src/java/org/slf4j/impl/StaticLoggerBinder.java
nlog4j/trunk/src/java/org/slf4j/impl/Util.java
nlog4j/trunk/src/java/org/slf4j/spi/LoggerFactoryBinder.java
Log:
Syncing with SLF4J 1.0RC3.
Modified: nlog4j/trunk/build.properties
==============================================================================
--- nlog4j/trunk/build.properties (original)
+++ nlog4j/trunk/build.properties Thu Dec 8 12:17:52 2005
@@ -1,2 +1,2 @@
- version=1.2.18
+ version=1.2.19
\ No newline at end of file
Modified: nlog4j/trunk/slf4j.xml
==============================================================================
--- nlog4j/trunk/slf4j.xml (original)
+++ nlog4j/trunk/slf4j.xml Thu Dec 8 12:17:52 2005
@@ -29,7 +29,7 @@
<delete>
<fileset dir="src/java/org/slf4j"
includes="**/*.java"
- excludes="impl/StaticBinder.java,
+ excludes="impl/StaticLoggerBinder.java,
impl/NLOG4JLoggerFactory.java"/>
</delete>
@@ -38,8 +38,16 @@
<copy todir="src/java/org/slf4j/">
<fileset dir="${tmp.slf4j}/">
<include name="**/*.java"/>
- <exclude name="**/impl/JDK14*.java"/>
+ <exclude name="**/impl/impl/StaticLoggerBinder.java"/>
+ <exclude name="Mark*.java"/>
+ <exclude name="IMarkerFactory.java"/>
+ <exclude name="**/impl/BasicMarker*.java"/>
+ <exclude name="**/impl/JCL*.java"/>
+ <exclude name="**/impl/MNOP*.java"/>
+ <exclude name="**/impl/MSimple*.java"/>
+ <exclude name="**/impl/JDK14*.java"/>
<exclude name="**/impl/Log4j*.java"/>
+ <exclude name="**/spi/MarkerFactoryBinder.java"/>
</fileset>
</copy>
Modified: nlog4j/trunk/src/java/org/apache/log4j/Logger.java
==============================================================================
--- nlog4j/trunk/src/java/org/apache/log4j/Logger.java (original)
+++ nlog4j/trunk/src/java/org/apache/log4j/Logger.java Thu Dec 8 12:17:52 2005
@@ -8,7 +8,6 @@
package org.apache.log4j;
import org.apache.log4j.spi.LoggerFactory;
-import org.slf4j.Marker;
/**
This is the central class in the log4j package. Most logging
@@ -146,83 +145,4 @@
}
- public boolean isDebugEnabled(Marker marker) {
- return isDebugEnabled();
- }
-
- public boolean isInfoEnabled(Marker marker) {
- return isInfoEnabled();
- }
-
- public boolean isWarnEnabled(Marker marker) {
- return isWarnEnabled();
- }
-
- public boolean isErrorEnabled(Marker marker) {
- return isErrorEnabled();
- }
-
- public void debug(Marker marker, String msg) {
- debug(msg);
- }
-
- public void debug(Marker marker, String format, Object arg) {
- debug(format, arg);
- }
-
- public void debug(Marker marker, String format, Object arg1, Object arg2) {
- debug(format, arg1, arg2);
- }
-
- public void debug(Marker marker, String msg, Throwable t) {
- debug(msg, t);
- }
-
- public void info(Marker marker, String msg) {
- info(msg);
- }
-
- public void info(Marker marker, String format, Object arg) {
- info(format, arg);
- }
-
- public void info(Marker marker, String format, Object arg1, Object arg2) {
- info(format, arg1, arg2);
- }
-
- public void info(Marker marker, String msg, Throwable t) {
- info(msg, t);
- }
-
- public void warn(Marker marker, String msg) {
- warn(msg);
- }
-
- public void warn(Marker marker, String format, Object arg) {
- warn(format, arg);
- }
-
- public void warn(Marker marker, String format, Object arg1, Object arg2) {
- warn(format, arg1, arg2);
- }
-
- public void warn(Marker marker, String msg, Throwable t) {
- warn(msg, t);
- }
-
- public void error(Marker marker, String msg) {
- error(msg);
- }
-
- public void error(Marker marker, String format, Object arg) {
- error(format, arg);
- }
-
- public void error(Marker marker, String format, Object arg1, Object arg2) {
- error(format, arg1, arg2);
- }
-
- public void error(Marker marker, String msg, Throwable t) {
- error(msg, t);
- }
}
Modified: nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java Thu Dec 8 12:17:52 2005
@@ -32,9 +32,7 @@
*/
package org.slf4j;
-
-import org.slf4j.impl.StaticBinder;
-import org.slf4j.impl.SystemPropBinder;
+import org.slf4j.impl.StaticLoggerBinder;
import org.slf4j.impl.Util;
// WARNING
@@ -43,59 +41,46 @@
// WARNING
/**
- * The <code>LoggerFactory</code> is a utility class producing Loggers
- * for various logging APIs, most notably for NLOG4J and JDK 1.4 logging.
- * Other implemenations such as [EMAIL PROTECTED] org.slf4j.impl.NOPLogger
NOPLogger} and
+ * The <code>LoggerFactory</code> is a utility class producing Loggers for
+ * various logging APIs, most notably for NLOG4J and JDK 1.4 logging. Other
+ * implemenations such as [EMAIL PROTECTED] org.slf4j.impl.NOPLogger
NOPLogger} and
* [EMAIL PROTECTED] org.slf4j.impl.SimpleLogger SimpleLogger} are also
supported.
- *
- * <p><code>LoggerFactory</code> is essentially a wrapper around an
- * [EMAIL PROTECTED] ILoggerFactory} instance bound with
<code>LoggerFactory</code>
- * at compile time.
*
- * <p>Please note that all methods in <code>LoggerFactory</code> are
- * static.
+ * <p>
+ * <code>LoggerFactory</code> is essentially a wrapper around an
+ * [EMAIL PROTECTED] ILoggerFactory} instance bound with
<code>LoggerFactory</code> at
+ * compile time.
+ *
+ * <p>
+ * Please note that all methods in <code>LoggerFactory</code> are static.
*
* @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a>
*/
public final class LoggerFactory {
-
+
static ILoggerFactory loggerFactory;
// private constructor prevents instantiation
private LoggerFactory() {
}
-
- //
- // WARNING Do not modify copies but the original in
- // $SLF4J_HOME/src/filtered-java/org/slf4j/
- //
- static {
-
- loggerFactory = new SystemPropBinder().getLoggerFactory();
- // if could get an adapter from the system properties, bind dynamically
- if (loggerFactory != null) {
- System.out.println("However, SLF4J will use
["+loggerFactory.getClass().getName()
- + "] adapter factory from system properties.");
- } else {
- try { // otherwise bind statically
- loggerFactory = StaticBinder.SINGLETON.getLoggerFactory();
- } catch (Exception e) {
- // we should never get here
- Util.reportFailure(
- "Could not instantiate instance of class [" +
StaticBinder.SINGLETON.getLoggerFactoryClassStr() + "]",
- e);
- }
+
+ static {
+ try {
+ loggerFactory = StaticLoggerBinder.SINGLETON.getLoggerFactory();
+ } catch (Exception e) {
+ // we should never get here
+ Util.reportFailure("Failed to instantiate logger ["
+ + StaticLoggerBinder.SINGLETON.getLoggerFactoryClassStr() + "]", e);
}
}
-
-
/**
- * Return a logger named according to the name parameter using the
- * statically bound [EMAIL PROTECTED] ILoggerFactory} instance.
+ * Return a logger named according to the name parameter using the statically
+ * bound [EMAIL PROTECTED] ILoggerFactory} instance.
*
- * @param name The name of the logger.
+ * @param name
+ * The name of the logger.
* @return logger
*/
public static Logger getLogger(String name) {
@@ -103,21 +88,22 @@
}
/**
- * Return a logger named corresponding to the class passed as parameter,
- * using the statically bound [EMAIL PROTECTED] ILoggerFactory} instance.
+ * Return a logger named corresponding to the class passed as parameter,
using
+ * the statically bound [EMAIL PROTECTED] ILoggerFactory} instance.
*
- * @param clazz the returned logger will be named after clazz
+ * @param clazz
+ * the returned logger will be named after clazz
* @return logger
*/
public static Logger getLogger(Class clazz) {
return loggerFactory.getLogger(clazz.getName());
}
-
+
/**
* Return the [EMAIL PROTECTED] ILoggerFactory} instance in use.
*
- * <p>Usually, the ILoggerFactory instance is bound with this class
- * at compile time.
+ * <p>ILoggerFactory instance is bound with this class at compile
+ * time.
*
* @return the ILoggerFactory instance in use
*/
Modified: nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java Thu Dec 8 12:17:52 2005
@@ -34,8 +34,6 @@
package org.slf4j.impl;
import org.slf4j.Logger;
-import org.slf4j.Marker;
-import org.slf4j.MarkingLogger;
/**
@@ -43,17 +41,17 @@
*
* @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a>
*/
-public final class NOPLogger implements MarkingLogger {
+public class NOPLogger implements Logger {
/**
* The unique instance of NOPLogger.
*/
public static final NOPLogger NOP_LOGGER = new NOPLogger();
/**
- * There is no point in creating multiple instances of NullLogger,
- * hence the private access modifier.
+ * There is no point in creating multiple instances of NOPLOgger,
+ * except by derived classes, hence the protected access for the
constructor.
*/
- private NOPLogger() {
+ protected NOPLogger() {
}
/**
@@ -67,17 +65,17 @@
* Always returns false.
* @return always false
*/
- public boolean isDebugEnabled() {
+ final public boolean isDebugEnabled() {
return false;
}
/** A NOP implementation. */
- public void debug(String msg) {
+ final public void debug(String msg) {
// NOP
}
/** A NOP implementation. */
- public void debug(String format, Object arg) {
+ final public void debug(String format, Object arg) {
// NOP
}
@@ -87,7 +85,7 @@
}
/** A NOP implementation. */
- public void debug(String msg, Throwable t) {
+ final public void debug(String msg, Throwable t) {
// NOP
}
@@ -95,167 +93,84 @@
* Always returns false.
* @return always false
*/
- public boolean isInfoEnabled() {
+ final public boolean isInfoEnabled() {
// NOP
return false;
}
- /** A NOP implementation. */
- public void debug(Marker marker, String msg) {
- }
-
- /** A NOP implementation. */
- public void debug(Marker marker, String format, Object arg) {
- }
-
- /** A NOP implementation. */
- public void debug(Marker marker, String format, Object arg1, Object arg2) {
- }
/** A NOP implementation. */
- public void debug(Marker marker, String msg, Throwable t) {
- }
-
- /**
- * Always returns false.
- * @return always false
- */
- public boolean isDebugEnabled(Marker marker) {
- return false;
- }
-
- /** A NOP implementation. */
- public void info(String msg) {
+ final public void info(String msg) {
// NOP
}
/** A NOP implementation. */
- public void info(String format, Object arg1) {
+ final public void info(String format, Object arg1) {
// NOP
}
/** A NOP implementation. */
- public void info(String format, Object arg1, Object arg2) {
+ final public void info(String format, Object arg1, Object arg2) {
// NOP
}
/** A NOP implementation. */
- public void info(String msg, Throwable t) {
+ final public void info(String msg, Throwable t) {
// NOP
}
- /** A NOP implementation. */
- public void info(Marker marker, String msg) {
- }
-
- /** A NOP implementation. */
- public void info(Marker marker, String format, Object arg) {
- }
-
- /** A NOP implementation. */
- public void info(Marker marker, String format, Object arg1, Object arg2) {
- }
-
- /** A NOP implementation. */
- public void info(Marker marker, String msg, Throwable t) {
- }
-
- public boolean isInfoEnabled(Marker marker) {
- return false;
- }
/**
* Always returns false.
* @return always false
*/
- public boolean isWarnEnabled() {
+ final public boolean isWarnEnabled() {
return false;
}
/** A NOP implementation. */
- public void warn(String msg) {
+ final public void warn(String msg) {
// NOP
}
/** A NOP implementation. */
- public void warn(String format, Object arg1) {
+ final public void warn(String format, Object arg1) {
// NOP
}
/** A NOP implementation. */
- public void warn(String format, Object arg1, Object arg2) {
+ final public void warn(String format, Object arg1, Object arg2) {
// NOP
}
/** A NOP implementation. */
- public void warn(String msg, Throwable t) {
+ final public void warn(String msg, Throwable t) {
// NOP
}
- /** A NOP implementation. */
- public void warn(Marker marker, String msg) {
- }
-
- /** A NOP implementation. */
- public void warn(Marker marker, String format, Object arg) {
- }
-
- /** A NOP implementation. */
- public void warn(Marker marker, String format, Object arg1, Object arg2) {
- }
-
- /** A NOP implementation. */
- public void warn(Marker marker, String msg, Throwable t) {
- }
-
- /** Always false. */
- public boolean isWarnEnabled(Marker marker) {
- return false;
- }
/** A NOP implementation. */
- public boolean isErrorEnabled() {
+ final public boolean isErrorEnabled() {
return false;
}
/** A NOP implementation. */
- public void error(String msg) {
+ final public void error(String msg) {
// NOP
}
/** A NOP implementation. */
- public void error(String format, Object arg1) {
+ final public void error(String format, Object arg1) {
// NOP
}
/** A NOP implementation. */
- public void error(String format, Object arg1, Object arg2) {
+ final public void error(String format, Object arg1, Object arg2) {
// NOP
}
/** A NOP implementation. */
- public void error(String msg, Throwable t) {
+ final public void error(String msg, Throwable t) {
// NOP
}
-
- /** A NOP implementation. */
- public void error(Marker marker, String msg) {
- }
-
- /** A NOP implementation. */
- public void error(Marker marker, String format, Object arg) {
- }
-
- /** A NOP implementation. */
- public final void error(Marker marker, String format, Object arg1, Object
arg2) {
- }
-
- /** A NOP implementation. */
- public void error(Marker marker, String msg, Throwable t) {
- }
-
- /** A NOP implementation. */
- public final boolean isErrorEnabled(Marker marker) {
- return false;
- }
}
Modified: nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java Thu Dec 8
12:17:52 2005
@@ -33,8 +33,7 @@
package org.slf4j.impl;
-import org.slf4j.Marker;
-import org.slf4j.MarkingLogger;
+import org.slf4j.Logger;
/**
@@ -62,7 +61,7 @@
*
* @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a>
*/
-public class SimpleLogger implements MarkingLogger {
+public class SimpleLogger implements Logger {
/**
* Mark the time when this class gets loaded into memory.
*/
@@ -94,14 +93,6 @@
}
/**
- * Always returns false.
- * @return always false
- */
- public boolean isDebugEnabled(Marker marker) {
- return false;
- }
-
- /**
* A NOP implementation, as this logger is permanently disabled for
* the DEBUG level.
*/
@@ -133,21 +124,6 @@
// NOP
}
- public void debug(Marker marker, String msg) {
- }
-
- public void debug(Marker marker, String format, Object arg) {
- debug(format, arg);
- }
-
- public void debug(Marker marker, String format, Object arg1, Object arg2) {
- debug(format, arg1, arg2);
- }
-
- public void debug(Marker marker, String msg, Throwable t) {
- debug(msg, t);
- }
-
/**
* This is our internal implementation for logging regular
(non-parameterized)
* log messages.
@@ -205,13 +181,6 @@
}
/**
- * Always returns true.
- */
- public boolean isInfoEnabled(Marker marker) {
- return true;
- }
-
- /**
* A simple implementation which always logs messages of level INFO according
* to the format outlined above.
*/
@@ -242,22 +211,6 @@
log(INFO_STR, msg.toString(), t);
}
- public void info(Marker marker, String msg) {
- info(msg);
- }
-
- public void info(Marker marker, String format, Object arg) {
- info(format, arg);
- }
-
- public void info(Marker marker, String format, Object arg1, Object arg2) {
- info(format, arg1, arg2);
- }
-
- public void info(Marker marker, String msg, Throwable t) {
- info(msg, t);
- }
-
/**
* Always returns true.
*/
@@ -266,13 +219,6 @@
}
/**
- * Always returns true.
- */
- public boolean isWarnEnabled(Marker marker) {
- return true;
- }
-
- /**
* A simple implementation which always logs messages of level WARN according
* to the format outlined above.
*/
@@ -303,22 +249,6 @@
log(WARN_STR, msg.toString(), t);
}
- public void warn(Marker marker, String msg) {
- warn(msg);
- }
-
- public void warn(Marker marker, String format, Object arg) {
- warn(format, arg);
- }
-
- public void warn(Marker marker, String format, Object arg1, Object arg2) {
- warn(format, arg1, arg2);
- }
-
- public void warn(Marker marker, String msg, Throwable t) {
- warn(msg, t);
- }
-
/**
* Always returns true.
*/
@@ -327,13 +257,6 @@
}
/**
- * Always returns true.
- */
- public boolean isErrorEnabled(Marker marker) {
- return true;
- }
-
- /**
* A simple implementation which always logs messages of level ERROR
acoording
* to the format outlined above.
*/
@@ -364,19 +287,4 @@
log(ERROR_STR, msg.toString(), t);
}
- public void error(Marker marker, String msg) {
- error(msg);
- }
-
- public void error(Marker marker, String format, Object arg) {
- error(format, arg);
- }
-
- public void error(Marker marker, String format, Object arg1, Object arg2) {
- error(format, arg1, arg2);
- }
-
- public void error(Marker marker, String msg, Throwable t) {
- error(msg, t);
- }
}
Modified: nlog4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFactory.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFactory.java
(original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFactory.java Thu Dec
8 12:17:52 2005
@@ -59,11 +59,11 @@
* Return an appropriate [EMAIL PROTECTED] SimpleLogger} instance by name.
*/
public Logger getLogger(String name) {
- Logger ulogger = (Logger) map.get(name);
- if(ulogger == null) {
- ulogger = new SimpleLogger(name);
- map.put(name, ulogger);
+ Logger slogger = (Logger) map.get(name);
+ if(slogger == null) {
+ slogger = new SimpleLogger(name);
+ map.put(name, slogger);
}
- return ulogger;
+ return slogger;
}
}
Modified: nlog4j/trunk/src/java/org/slf4j/impl/StaticLoggerBinder.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/StaticLoggerBinder.java
(original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/StaticLoggerBinder.java Thu Dec
8 12:17:52 2005
@@ -34,9 +34,7 @@
package org.slf4j.impl;
import org.slf4j.LoggerFactory;
-import org.slf4j.MarkerFactory;
import org.slf4j.ILoggerFactory;
-import org.slf4j.IMarkerFactory;
import org.slf4j.spi.LoggerFactoryBinder;
/**
Modified: nlog4j/trunk/src/java/org/slf4j/impl/Util.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/Util.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/Util.java Thu Dec 8 12:17:52 2005
@@ -42,9 +42,9 @@
*/
public class Util {
- static public void reportFailure(String msg, Throwable t) {
+ static final public void reportFailure(String msg, Throwable t) {
System.err.println(msg);
- System.err.println("Reported exception follows.");
+ System.err.println("Reported exception:");
t.printStackTrace();
}
}
Modified: nlog4j/trunk/src/java/org/slf4j/spi/LoggerFactoryBinder.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/spi/LoggerFactoryBinder.java
(original)
+++ nlog4j/trunk/src/java/org/slf4j/spi/LoggerFactoryBinder.java Thu Dec
8 12:17:52 2005
@@ -58,7 +58,7 @@
*
* <p>This method allows the developer to intterogate this binder's
intention
* which may be different from the [EMAIL PROTECTED] ILoggerFactory}
instance it is able to
- * yields in practice. The discrepency should only occur in case of errors.
+ * yield in practice. The discrepency should only occur in case of errors.
*
* @return the class name of the intended [EMAIL PROTECTED] ILoggerFactory}
instance
*/
_______________________________________________
nlog4j-dev mailing list
[email protected]
http://slf4j.org/mailman/listinfo/nlog4j-dev