diff --git a/build.xml b/build.xml index b76fdb7e..19ad6a81 100644 --- a/build.xml +++ b/build.xml @@ -5,7 +5,7 @@ - + @@ -144,11 +144,19 @@ - + + + + + + + + diff --git a/src/filtered-java/org/slf4j/LoggerFactory.java b/src/filtered-java/org/slf4j/LoggerFactory.java index fd5bbe03..12d76049 100644 --- a/src/filtered-java/org/slf4j/LoggerFactory.java +++ b/src/filtered-java/org/slf4j/LoggerFactory.java @@ -37,16 +37,27 @@ package org.slf4j; // WARNING /** - * The LoggerFactory can produce Loggers for various logging APIs, - * most notably for log4j, JDK 1.4 logging. Other implemenations such as - * {@link org.slf4j.impl.NOPLogger NOPLogger} and + * The LoggerFactory is a utility class producing Loggers + * for various logging APIs, most notably for NLOG4J and JDK 1.4 logging. + * Other implemenations such as {@link org.slf4j.impl.NOPLogger NOPLogger} and * {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported. * + *

LoggerFactory is essentially a wrapper around an + * {@link ILoggerFactory} instance bound with LoggerFactory + * at compile time. + * + *

Please note that all methods in LoggerFactory are + * static. + * * @author Ceki Gülcü */ -public class LoggerFactory { +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/ @@ -74,7 +85,7 @@ public class LoggerFactory { } /** - * Fetch the appropriate adapter as intructed by the system propties. + * Fetch the appropriate ILoggerFactory as intructed by the system propties. * * @return The appropriate ILoggerFactory instance as directed from the * system properties @@ -114,7 +125,8 @@ public class LoggerFactory { /** * Return a logger named according to the name parameter using the - * previously bound {@link LoggerFactoryAdapter adapter}. + * statically bound {@link ILoggerFactory} instance. + * * @param name The name of the logger. * @return logger */ @@ -122,6 +134,13 @@ public class LoggerFactory { return loggerFactory.getLogger(name); } + /** + * Return a logger named corresponding to the class passed as parameter, + * using the statically bound {@link ILoggerFactory} instance. + * + * @param clazz the returned logger will be named after clazz + * @return logger + */ public static Logger getLogger(Class clazz) { return loggerFactory.getLogger(clazz.getName()); } diff --git a/src/filtered-java/org/slf4j/MarkerFactory.java b/src/filtered-java/org/slf4j/MarkerFactory.java index bc507623..a9d16e75 100644 --- a/src/filtered-java/org/slf4j/MarkerFactory.java +++ b/src/filtered-java/org/slf4j/MarkerFactory.java @@ -38,14 +38,22 @@ package org.slf4j; /** - * A static MarkerFactory bound to a specific {@link IMarkerFactory} instance at - * at compile time. + * MarkerFactory is a utility class producing Marker instances as appropriate + * for each logging systems. + * + * MarkerFactory is essentially a wrapper around an IMarkerFactory instance + * bound with the MarkerFactory class at compile time. + * + * Please note that all methods in MarkerFactory are static. * * @author Ceki Gulcu */ public class MarkerFactory { static IMarkerFactory markerFactory; + private MarkerFactory() { + } + // // WARNING Do not modify copies but the original at // $SLF4J_HOME/src/filtered-java/org/slf4j/ @@ -59,14 +67,14 @@ public class MarkerFactory { Util.reportFailure( "Could not instantiate instance of class [" + markerFactoryClassStr + "]", e); - } - + } } /** * Return a Marker instnace as specified by the name parameter using the - * previously bound {@link IMakerFactory marker factory instance}. - * @param name The name of the Marker. + * previously bound {@link IMarkerFactory} instance. + * + * @param name The name of the {@link Marker} object to return. * @return marker */ public static Marker getMarker(String name) { diff --git a/src/java/org/slf4j/ILoggerFactory.java b/src/java/org/slf4j/ILoggerFactory.java index c0e1d1d0..88c077d7 100644 --- a/src/java/org/slf4j/ILoggerFactory.java +++ b/src/java/org/slf4j/ILoggerFactory.java @@ -34,6 +34,9 @@ package org.slf4j; /** + * Implementaitons of this interface are used to manufacture {@link Logger} + * instances. + * * ILoggerFactory interface is used internally by {@link * LoggerFactory}. * diff --git a/src/java/org/slf4j/Logger.java b/src/java/org/slf4j/Logger.java index 58e27105..cda2045f 100644 --- a/src/java/org/slf4j/Logger.java +++ b/src/java/org/slf4j/Logger.java @@ -56,6 +56,14 @@ public interface Logger { */ public void debug(String msg); + + /** + * Log a message with the specific Marker at the DEBUG level. + * + * @param marker The marker specific for this log statement + * @param msg the message string to be logged + */ + public void debug(Marker marker, String msg); /** * Log a message at the DEBUG level according to the specified format diff --git a/src/java/org/slf4j/Marker.java b/src/java/org/slf4j/Marker.java index ad33803b..df5195a9 100644 --- a/src/java/org/slf4j/Marker.java +++ b/src/java/org/slf4j/Marker.java @@ -35,13 +35,47 @@ package org.slf4j; import java.util.Iterator; +/** + * Markers are named objects which can be used to enrich log statements. + * + *

Markers can contain child markers which can contain children of their + * own. + * + * @author Ceki Gulcu + */ public interface Marker { + /** + * Get the name of this Marker. + * @return name of marker + */ public String getName(); + /** + * Add a child Marker to this Marker. + * @param child a child marker + */ public void add(Marker child); + + /** + * Remove a child Marker. + * @param child the child Marker to remove + * @return true if child could be found and removed, false otherwise. + */ public boolean remove(Marker child); + + /** + * Does this marker have children? + * @return true if this marker has children, false otherwise. + */ public boolean hasChildren(); + + /** + * Returns an Iterator which can be used to iterator over the children of this + * marker. An empty iterator is returned when this marker has no children. + * + * @return Iterator over the children of this marker + */ public Iterator iterator(); // void makeImmutable(); diff --git a/tests/build.xml b/tests/build.xml index 6a2ca841..038c7eb6 100644 --- a/tests/build.xml +++ b/tests/build.xml @@ -27,15 +27,15 @@ - + - + - - + + @@ -107,7 +107,7 @@ InvokeNOP, InvokeSimple, InvokeJDK14, - InvokeNLOG4J1212" + InvokeNLOG4J12x" /> @@ -143,10 +143,10 @@ - - + + - + diff --git a/tests/lib/log4j-1.2.10.jar b/tests/lib/log4j-1.2.10.jar deleted file mode 100644 index 0a64490a..00000000 Binary files a/tests/lib/log4j-1.2.10.jar and /dev/null differ diff --git a/tests/lib/nlog4j-1.2.12.jar b/tests/lib/nlog4j-1.2.12.jar deleted file mode 100644 index b48ce45c..00000000 Binary files a/tests/lib/nlog4j-1.2.12.jar and /dev/null differ