From 3b040e36ff55b7e98fe16e09a4c813d3dab524d6 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Mon, 17 Sep 2012 23:36:12 +0200 Subject: [PATCH] improved javadocs --- .../java/org/apache/commons/logging/Log.java | 4 ++ .../apache/commons/logging/LogFactory.java | 6 +- .../org/slf4j/bridge/SLF4JBridgeHandler.java | 2 +- pom.xml | 67 +++--------------- .../main/java/org/slf4j/ILoggerFactory.java | 1 + .../main/java/org/slf4j/IMarkerFactory.java | 6 +- slf4j-api/src/main/java/org/slf4j/Logger.java | 18 +++++ slf4j-api/src/main/java/org/slf4j/MDC.java | 19 ++++-- slf4j-api/src/main/java/org/slf4j/Marker.java | 3 +- .../main/java/org/slf4j/MarkerFactory.java | 1 + .../java/org/slf4j/helpers/NOPLogger.java | 10 +-- .../org/slf4j/cal10n/LocLoggerFactory.java | 5 +- .../main/java/org/slf4j/cal10n/package.html | 12 ++++ .../main/java/org/slf4j/ext/EventData.java | 1 + .../java/org/slf4j/ext/LoggerWrapper.java | 68 +++++++++---------- .../java/org/slf4j/ext/XLoggerFactory.java | 13 ++-- .../src/main/java/org/slf4j/ext/package.html | 2 +- .../java/org/slf4j/profiler/SpacePadder.java | 3 + .../java/org/slf4j/impl/StaticMDCBinder.java | 4 +- .../test/java/org/slf4j/InvocationTest.java | 2 +- .../org/slf4j/migrator/ProjectConverter.java | 6 +- .../java/org/slf4j/impl/SimpleLogger.java | 10 +-- slf4j-site/src/site/pages/manual.html | 23 ++++++- slf4j-site/src/site/pages/news.html | 10 +++ 24 files changed, 163 insertions(+), 133 deletions(-) create mode 100644 slf4j-ext/src/main/java/org/slf4j/cal10n/package.html diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java index 7b425093..50f6d48c 100644 --- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java +++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/Log.java @@ -102,6 +102,8 @@ public interface Log { *

Call this method to prevent having to perform expensive operations * (for example, String concatenation) * when the log level is more than info.

+ * + * @return true if info enabled, false otherwise */ public boolean isInfoEnabled(); @@ -112,6 +114,8 @@ public interface Log { *

Call this method to prevent having to perform expensive operations * (for example, String concatenation) * when the log level is more than trace.

+ * + * @return true if trace enabled, false otherwise */ public boolean isTraceEnabled(); diff --git a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java index cb9ac8a5..779ad5b7 100644 --- a/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java +++ b/jcl-over-slf4j/src/main/java/org/apache/commons/logging/LogFactory.java @@ -140,8 +140,8 @@ public abstract class LogFactory { * Return the configuration attribute with the specified name (if any), or * null if there is no such attribute. * - * @param name - * Name of the attribute to return + * @param name Name of the attribute to return + * @return configuration attribute */ public abstract Object getAttribute(String name); @@ -149,6 +149,8 @@ public abstract class LogFactory { * Return an array containing the names of all currently defined configuration * attributes. If there are no such attributes, a zero length array is * returned. + * + * @return names of all currently defined configuration attributes */ public abstract String[] getAttributeNames(); 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 c69c9d02..c41fa99a 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 @@ -146,7 +146,7 @@ public class SLF4JBridgeHandler extends Handler { /** * Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise. * - * @return + * @return true if SLF4JBridgeHandler is already installed, false other wise * @throws SecurityException */ public static boolean isInstalled() throws SecurityException { diff --git a/pom.xml b/pom.xml index 30d2be2a..a57ff6c5 100644 --- a/pom.xml +++ b/pom.xml @@ -216,14 +216,14 @@ true + org.apache.maven.plugins maven-javadoc-plugin 2.8 - true - org.slf4j.migrator:org.slf4j.migrator.* - + + org.slf4j.migrator:org.slf4j.migrator.* http://java.sun.com/j2se/1.5.0/docs/api @@ -238,7 +238,7 @@ SLF4J extensions - org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent + org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent @@ -247,16 +247,18 @@ org.apache.commons.* - - Apache log4j - org.apache.log4j - - java.util.logging (JUL) to SLF4J bridge org.slf4j.bridge + + Apache log4j + org.apache.log4j:org.apache.log4j.* + + + + @@ -275,53 +277,6 @@ true - - osgi - - osgi-over-slf4j - slf4j-osgi-test-bundle - slf4j-osgi-integration-test - - - - - m2apache.snapshots - http://people.apache.org/repo/m2-snapshot-repository - - false - - - true - - - - - springframework.org - Springframework Maven SNAPSHOT Repository - http://static.springframework.org/maven2-snapshots/ - - true - - - - - - - - apache.snapshots - Apache Snapshot Plugin Repository - http://people.apache.org/repo/m2-snapshot-repository - - false - - - true - - - - - - javadocjar diff --git a/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java index 9b259f98..4b5eb278 100644 --- a/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java +++ b/slf4j-api/src/main/java/org/slf4j/ILoggerFactory.java @@ -52,6 +52,7 @@ public interface ILoggerFactory { * return the same logger instance regardless of the requested name. * * @param name the name of the Logger to return + * @return a Logger instance */ public Logger getLogger(String name); } diff --git a/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java b/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java index a7dc61cb..8ec5a75b 100644 --- a/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java +++ b/slf4j-api/src/main/java/org/slf4j/IMarkerFactory.java @@ -53,7 +53,8 @@ public interface IMarkerFactory { /** * Checks if the marker with the name already exists. If name is null, then false * is returned. - * + * + * @param name logger name to check for * @return true id the marker exists, false otherwise. */ boolean exists(String name); @@ -73,7 +74,8 @@ public interface IMarkerFactory { /** * Create a marker which is detached (even at birth) from this IMarkerFactory. - * + * + * @param name marker name * @return a dangling marker * @since 1.5.1 */ diff --git a/slf4j-api/src/main/java/org/slf4j/Logger.java b/slf4j-api/src/main/java/org/slf4j/Logger.java index 88532857..e39727ce 100644 --- a/slf4j-api/src/main/java/org/slf4j/Logger.java +++ b/slf4j-api/src/main/java/org/slf4j/Logger.java @@ -52,6 +52,13 @@ package org.slf4j; * } * * + * Be sure to read the FAQ entry relating to parameterized + * logging. Note that logging statements can be parameterized in + * presence of an exception/throwable. + * + *

Once you are comfortable using loggers, i.e. instances of this interface, consider using + * MDC as well as Markers.

+ * * @author Ceki Gülcü */ public interface Logger { @@ -66,6 +73,7 @@ public interface Logger { /** * Return the name of this Logger instance. + * @return name of this logger instance */ public String getName(); @@ -148,6 +156,9 @@ public interface Logger { * marker data is also taken into account. * * @param marker The marker data to take into consideration + * @return True if this Logger is enabled for the TRACE level, + * false otherwise. + * * @since 1.4 */ public boolean isTraceEnabled(Marker marker); @@ -285,6 +296,8 @@ public interface Logger { * marker data is also taken into account. * * @param marker The marker data to take into consideration + * @return True if this Logger is enabled for the DEBUG level, + * false otherwise. */ public boolean isDebugEnabled(Marker marker); @@ -415,6 +428,7 @@ public interface Logger { * data is also taken into consideration. * * @param marker The marker data to take into consideration + * @return true if this logger is warn enabled, false otherwise */ public boolean isInfoEnabled(Marker marker); @@ -544,6 +558,8 @@ public interface Logger { * data is also taken into consideration. * * @param marker The marker data to take into consideration + * @return True if this Logger is enabled for the WARN level, + * false otherwise. */ public boolean isWarnEnabled(Marker marker); @@ -671,6 +687,8 @@ public interface Logger { * marker data is also taken into consideration. * * @param marker The marker data to take into consideration + * @return True if this Logger is enabled for the ERROR level, + * false otherwise. */ public boolean isErrorEnabled(Marker marker); diff --git a/slf4j-api/src/main/java/org/slf4j/MDC.java b/slf4j-api/src/main/java/org/slf4j/MDC.java index ed61b1fd..bdb30e89 100644 --- a/slf4j-api/src/main/java/org/slf4j/MDC.java +++ b/slf4j-api/src/main/java/org/slf4j/MDC.java @@ -45,7 +45,7 @@ import org.slf4j.spi.MDCAdapter; * and slf4j-nop, {@link NOPMDCAdapter} will be used. * *

- * Thus, as a SLF4J user, you can take advantage of MDC in the presence of log4j + * 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. * @@ -90,13 +90,16 @@ public class MDC { } /** - * Put a context value (the val parameter) as identified with the - * key parameter into the current thread's context map. The + * Put a diagnostic context value (the val parameter) as identified with the + * key parameter into the current thread's diagnostic context map. The * key parameter cannot be null. The val parameter * can be null only if the underlying implementation supports it. * *

* This method delegates all work to the MDC of the underlying logging system. + * + * @param key non-null key + * @param val value to put in the map * * @throws IllegalArgumentException * in case the "key" parameter is null @@ -114,12 +117,13 @@ public class MDC { } /** - * Get the context identified by the key parameter. The + * Get the diagnostic context identified by the key parameter. The * key parameter cannot be null. * *

* This method delegates all work to the MDC of the underlying logging system. - * + * + * @param key * @return the string value identified by the key parameter. * @throws IllegalArgumentException * in case the "key" parameter is null @@ -137,11 +141,12 @@ public class MDC { } /** - * Remove the the context identified by the key parameter using + * Remove the diagnostic context identified by the key parameter using * the underlying system's MDC implementation. The key parameter * cannot be null. This method does nothing if there is no previous value * associated with key. - * + * + * @param key * @throws IllegalArgumentException * in case the "key" parameter is null */ diff --git a/slf4j-api/src/main/java/org/slf4j/Marker.java b/slf4j-api/src/main/java/org/slf4j/Marker.java index 1349c403..3d59b524 100644 --- a/slf4j-api/src/main/java/org/slf4j/Marker.java +++ b/slf4j-api/src/main/java/org/slf4j/Marker.java @@ -115,8 +115,7 @@ public interface Marker extends Serializable { * * If 'name' is null the returned value is always false. * - * @param other - * The marker to test for inclusion. + * @param name The marker name to test for inclusion. * @return Whether this marker contains the other marker. */ public boolean contains(String name); diff --git a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java index 84cb4e82..84cfcb6b 100644 --- a/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java +++ b/slf4j-api/src/main/java/org/slf4j/MarkerFactory.java @@ -74,6 +74,7 @@ public class MarkerFactory { /** * Create a marker which is detached (even at birth) from the MarkerFactory. * + * @param name the name of the marker * @return a dangling marker * @since 1.5.1 */ diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/NOPLogger.java b/slf4j-api/src/main/java/org/slf4j/helpers/NOPLogger.java index b36be306..a1709ddb 100644 --- a/slf4j-api/src/main/java/org/slf4j/helpers/NOPLogger.java +++ b/slf4j-api/src/main/java/org/slf4j/helpers/NOPLogger.java @@ -80,7 +80,7 @@ public class NOPLogger extends MarkerIgnoringBase { } /** A NOP implementation. */ - public final void trace(String format, Object[] argArray) { + public final void trace(String format, Object... argArray) { // NOP } @@ -113,7 +113,7 @@ public class NOPLogger extends MarkerIgnoringBase { } /** A NOP implementation. */ - public final void debug(String format, Object[] argArray) { + public final void debug(String format, Object... argArray) { // NOP } @@ -150,7 +150,7 @@ public class NOPLogger extends MarkerIgnoringBase { } /** A NOP implementation. */ - public final void info(String format, Object[] argArray) { + public final void info(String format, Object... argArray) { // NOP } @@ -185,7 +185,7 @@ public class NOPLogger extends MarkerIgnoringBase { } /** A NOP implementation. */ - public final void warn(String format, Object[] argArray) { + public final void warn(String format, Object... argArray) { // NOP } @@ -217,7 +217,7 @@ public class NOPLogger extends MarkerIgnoringBase { } /** A NOP implementation. */ - public final void error(String format, Object[] argArray) { + public final void error(String format, Object... argArray) { // NOP } diff --git a/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLoggerFactory.java b/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLoggerFactory.java index de1f5624..4e21dac2 100644 --- a/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLoggerFactory.java +++ b/slf4j-ext/src/main/java/org/slf4j/cal10n/LocLoggerFactory.java @@ -56,7 +56,7 @@ public class LocLoggerFactory { * Get an LocLogger instance by name. * * @param name - * @return + * @return LocLogger instance by name. */ public LocLogger getLocLogger(String name) { return new LocLogger(LoggerFactory.getLogger(name), imc); @@ -67,9 +67,8 @@ public class LocLoggerFactory { * after the class. * * @param clazz - * @return + * @return LocLogger instance by class */ - @SuppressWarnings("unchecked") public LocLogger getLocLogger(Class clazz) { return getLocLogger(clazz.getName()); } diff --git a/slf4j-ext/src/main/java/org/slf4j/cal10n/package.html b/slf4j-ext/src/main/java/org/slf4j/cal10n/package.html new file mode 100644 index 00000000..39cfc8d1 --- /dev/null +++ b/slf4j-ext/src/main/java/org/slf4j/cal10n/package.html @@ -0,0 +1,12 @@ + + + + + + + + + +

SLF4J API extensions

+ + diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java b/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java index c936a2ea..7430548a 100755 --- a/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java +++ b/slf4j-ext/src/main/java/org/slf4j/ext/EventData.java @@ -97,6 +97,7 @@ public class EventData implements Serializable { /** * Serialize all the EventData items into an XML representation. * + * @param map the Map to transform * @return an XML String containing all the EventDAta items. */ public static String toXML(Map map) { 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 c1aeaffa..29a881d2 100644 --- a/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java +++ b/slf4j-ext/src/main/java/org/slf4j/ext/LoggerWrapper.java @@ -130,17 +130,17 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void trace(String format, Object[] argArray) { + public void trace(String format, Object... args) { if (!logger.isTraceEnabled()) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(null, fqcn, - LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null); + LocationAwareLogger.TRACE_INT, formattedMessage, args, null); } else { - logger.trace(format, argArray); + logger.trace(format, args); } } @@ -210,16 +210,16 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void trace(Marker marker, String format, Object[] argArray) { + public void trace(Marker marker, String format, Object... args) { if (!logger.isTraceEnabled(marker)) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, - LocationAwareLogger.TRACE_INT, formattedMessage, argArray, null); + LocationAwareLogger.TRACE_INT, formattedMessage, args, null); } else { - logger.trace(marker, format, argArray); + logger.trace(marker, format, args); } } @@ -305,7 +305,7 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void debug(String format, Object[] argArray) { + public void debug(String format, Object... argArray) { if (!logger.isDebugEnabled()) return; @@ -384,7 +384,7 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void debug(Marker marker, String format, Object[] argArray) { + public void debug(Marker marker, String format, Object... argArray) { if (!logger.isDebugEnabled(marker)) return; if (instanceofLAL) { @@ -480,17 +480,17 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void info(String format, Object[] argArray) { + public void info(String format, Object... args) { if (!logger.isInfoEnabled()) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(null, fqcn, - LocationAwareLogger.INFO_INT, formattedMessage, argArray, null); + LocationAwareLogger.INFO_INT, formattedMessage, args, null); } else { - logger.info(format, argArray); + logger.info(format, args); } } @@ -560,16 +560,16 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void info(Marker marker, String format, Object[] argArray) { + public void info(Marker marker, String format, Object... args) { if (!logger.isInfoEnabled(marker)) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, - LocationAwareLogger.INFO_INT, formattedMessage, argArray, null); + LocationAwareLogger.INFO_INT, formattedMessage, args, null); } else { - logger.info(marker, format, argArray); + logger.info(marker, format, args); } } @@ -652,17 +652,17 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void warn(String format, Object[] argArray) { + public void warn(String format, Object... args) { if (!logger.isWarnEnabled()) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(null, fqcn, - LocationAwareLogger.WARN_INT, formattedMessage, argArray, null); + LocationAwareLogger.WARN_INT, formattedMessage, args, null); } else { - logger.warn(format, argArray); + logger.warn(format, args); } } @@ -732,16 +732,16 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void warn(Marker marker, String format, Object[] argArray) { + public void warn(Marker marker, String format, Object... args) { if (!logger.isWarnEnabled(marker)) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, - LocationAwareLogger.WARN_INT, formattedMessage, argArray, null); + LocationAwareLogger.WARN_INT, formattedMessage, args, null); } else { - logger.warn(marker, format, argArray); + logger.warn(marker, format, args); } } @@ -827,17 +827,17 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void error(String format, Object[] argArray) { + public void error(String format, Object... args) { if (!logger.isErrorEnabled()) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(null, fqcn, - LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null); + LocationAwareLogger.ERROR_INT, formattedMessage, args, null); } else { - logger.error(format, argArray); + logger.error(format, args); } } @@ -907,16 +907,16 @@ public class LoggerWrapper implements Logger { /** * Delegate to the appropriate method of the underlying logger. */ - public void error(Marker marker, String format, Object[] argArray) { + public void error(Marker marker, String format, Object... args) { if (!logger.isErrorEnabled(marker)) return; if (instanceofLAL) { - String formattedMessage = MessageFormatter.arrayFormat(format, argArray) + String formattedMessage = MessageFormatter.arrayFormat(format, args) .getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, - LocationAwareLogger.ERROR_INT, formattedMessage, argArray, null); + LocationAwareLogger.ERROR_INT, formattedMessage, args, null); } else { - logger.error(marker, format, argArray); + logger.error(marker, format, args); } } diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/XLoggerFactory.java b/slf4j-ext/src/main/java/org/slf4j/ext/XLoggerFactory.java index afd623e2..04452d49 100644 --- a/slf4j-ext/src/main/java/org/slf4j/ext/XLoggerFactory.java +++ b/slf4j-ext/src/main/java/org/slf4j/ext/XLoggerFactory.java @@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory; * {@link LoggerFactory} producing {@link XLogger} instances. * *

Contrary to {@link LoggerFactory#getLogger(String)} method of - * {@link LoggerFactory}, each call to {@link getXLogger} - * produces a new instance of XLogger. This should not matter because an - * XLogger instance does not have any state beyond that of the Logger instance - * it wraps. + * {@link LoggerFactory}, each call to {@link #getXLogger(String)} + * produces a new instance of XLogger. This should not matter + * because an XLogger instance does not have any state beyond that of + * the {@link org.slf4j.Logger Logger} instance it wraps. * * @author Ralph Goers * @author Ceki Gülcü @@ -46,7 +46,7 @@ public class XLoggerFactory { * Get an XLogger instance by name. * * @param name - * @return + * @return XLogger instance */ public static XLogger getXLogger(String name) { return new XLogger(LoggerFactory.getLogger(name)); @@ -57,9 +57,8 @@ public class XLoggerFactory { * will be named after the class. * * @param clazz - * @return + * @return XLogger instance by name */ - @SuppressWarnings("unchecked") public static XLogger getXLogger(Class clazz) { return getXLogger(clazz.getName()); } diff --git a/slf4j-ext/src/main/java/org/slf4j/ext/package.html b/slf4j-ext/src/main/java/org/slf4j/ext/package.html index f9ea74a8..5c55a91b 100644 --- a/slf4j-ext/src/main/java/org/slf4j/ext/package.html +++ b/slf4j-ext/src/main/java/org/slf4j/ext/package.html @@ -7,6 +7,6 @@ -

SLF4J API extensions

+

Localized logging using the CAL10N API.

diff --git a/slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java b/slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java index 8e5d4dc2..804cf886 100644 --- a/slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java +++ b/slf4j-ext/src/main/java/org/slf4j/profiler/SpacePadder.java @@ -60,6 +60,9 @@ public class SpacePadder { /** * Fast space padding method. + * + * @param sbuf the buffer to pad + * @param length the target size of the buffer after padding */ final static public void spacePad(StringBuffer sbuf, int length) { while (length >= 32) { 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 ebdbeba8..4972927d 100644 --- a/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java +++ b/slf4j-jcl/src/main/java/org/slf4j/impl/StaticMDCBinder.java @@ -46,7 +46,9 @@ public class StaticMDCBinder { /** * Currently this method always returns an instance of - * {@link StaticMDCBinder}. + * {@link NOPMDCAdapter}. + * + * @return instance of NOPMDCAdapter */ public MDCAdapter getMDCA() { return new NOPMDCAdapter(); diff --git a/slf4j-log4j12/src/test/java/org/slf4j/InvocationTest.java b/slf4j-log4j12/src/test/java/org/slf4j/InvocationTest.java index 4044decb..ddd4d2bf 100644 --- a/slf4j-log4j12/src/test/java/org/slf4j/InvocationTest.java +++ b/slf4j-log4j12/src/test/java/org/slf4j/InvocationTest.java @@ -159,7 +159,7 @@ public class InvocationTest extends TestCase { } public void testMDCContextMapValues() { - Map map = new HashMap(); + Map map = new HashMap(); map.put("ka", "va"); map.put("kb", "vb"); diff --git a/slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java b/slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java index 3499c395..a0ddead3 100644 --- a/slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java +++ b/slf4j-migrator/src/main/java/org/slf4j/migrator/ProjectConverter.java @@ -57,9 +57,9 @@ public class ProjectConverter { * Ask for concrete matcher implementation depending on the conversion mode * Ask for user confirmation to convert the selected source directory if valid * Ask for user confirmation in case of number of files to convert > 1000 - * - * @return true if init operation complete - * @throws IOException + * + * @param conversionType + * @param progressListener */ public ProjectConverter(int conversionType, ProgressListener progressListener) { this.progressListener = progressListener; diff --git a/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java b/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java index 13549948..6f4493be 100644 --- a/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java +++ b/slf4j-simple/src/main/java/org/slf4j/impl/SimpleLogger.java @@ -466,7 +466,7 @@ public class SimpleLogger extends MarkerIgnoringBase { * Perform double parameter substitution before logging the message of level * TRACE according to the format outlined above. */ - public void trace(String format, Object[] argArray) { + public void trace(String format, Object... argArray) { formatAndLog(LOG_LEVEL_TRACE, format, argArray); } @@ -508,7 +508,7 @@ public class SimpleLogger extends MarkerIgnoringBase { * Perform double parameter substitution before logging the message of level * DEBUG according to the format outlined above. */ - public void debug(String format, Object[] argArray) { + public void debug(String format, Object... argArray) { formatAndLog(LOG_LEVEL_DEBUG, format, argArray); } @@ -550,7 +550,7 @@ public class SimpleLogger extends MarkerIgnoringBase { * Perform double parameter substitution before logging the message of level * INFO according to the format outlined above. */ - public void info(String format, Object[] argArray) { + public void info(String format, Object... argArray) { formatAndLog(LOG_LEVEL_INFO, format, argArray); } @@ -592,7 +592,7 @@ public class SimpleLogger extends MarkerIgnoringBase { * Perform double parameter substitution before logging the message of level * WARN according to the format outlined above. */ - public void warn(String format, Object[] argArray) { + public void warn(String format, Object... argArray) { formatAndLog(LOG_LEVEL_WARN, format, argArray); } @@ -634,7 +634,7 @@ public class SimpleLogger extends MarkerIgnoringBase { * Perform double parameter substitution before logging the message of level * ERROR according to the format outlined above. */ - public void error(String format, Object[] argArray) { + public void error(String format, Object... argArray) { formatAndLog(LOG_LEVEL_ERROR, format, argArray); } diff --git a/slf4j-site/src/site/pages/manual.html b/slf4j-site/src/site/pages/manual.html index afd1b697..490bdb96 100644 --- a/slf4j-site/src/site/pages/manual.html +++ b/slf4j-site/src/site/pages/manual.html @@ -281,7 +281,13 @@ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail addition to logback-classic-${logback.version}.jar, this will pull slf4j-api-${project.version}.jar as well as logback-core-${logback.version}.jar into your - project.

+ project. Note that explicitly declaring a dependency on + logback-core-${logback.version} or + slf4j-api-${project.version}.jar is not wrong and may + be necessary to impose the correct version of said artifacts by + virtue of Maven's "nearest definition" dependency mediation + rule. +

<dependency> 
   <groupId>ch.qos.logback</groupId>
@@ -297,7 +303,13 @@ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
       pom.xml file as shown below. In addition to
       slf4j-log4j12-${project.version}.jar, this will pull
       slf4j-api-${project.version}.jar as well as
-      log4j-${log4j.version}.jar into your project.

+ log4j-${log4j.version}.jar into your project. Note + that explicitly declaring a dependency on + log4j-${log4j.version}.jar or + slf4j-api-${project.version}.jar is not wrong and may + be necessary to impose the correct version of said artifacts by + virtue of Maven's "nearest definition" dependency mediation + rule.

<dependency> 
   <groupId>org.slf4j</groupId>
@@ -313,7 +325,12 @@ SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
       "org.slf4j:slf4j-jdk14" as a dependency in your pom.xml
       file as shown below. In addition to
       slf4j-jdk14-${project.version}.jar, this will pull
-      slf4j-api-${project.version}.jar into your project.

+ slf4j-api-${project.version}.jar into your project. + Note that explicitly declaring a dependency on + slf4j-api-${project.version}.jar is not wrong and may + be necessary to impose the correct version of said artifact by + virtue of Maven's "nearest definition" dependency mediation + rule.

<dependency> 
   <groupId>org.slf4j</groupId>
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index b011698c..386fdaf1 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,6 +29,16 @@
 
    
+

14th of September, 2012 - Release of SLF4J 1.7.2

+ +

Fixed bug + 272. All Logger implementations shipping with + SLF4J use Object... instead of Object[] + to avoid compiler warnings.

+ +
+

14th of September, 2012 - Release of SLF4J 1.7.1