SLF4J 1.0-rc6

org.slf4j.impl
Class MSimpleLogger

java.lang.Object
  |
  +--org.slf4j.impl.MSimpleLogger
All Implemented Interfaces:
Logger, MarkingLogger

public class MSimpleLogger
extends java.lang.Object
implements MarkingLogger

A simple (and direct) implementation that logs messages of level INFO or higher on the console (System.out).

The output includes the relative time in milliseconds, thread name, the level, logger name, and the message followed by the line separator for the host. In log4j terms it amounts to the "%r [%t] %level %logger - %m%n" pattern. *

Sample output follows.

  176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
  225 [main] INFO examples.SortAlgo - Entered the sort method.
  304 [main] INFO examples.SortAlgo - Dump of interger array:
  317 [main] INFO examples.SortAlgo - Element [0] = 0
  331 [main] INFO examples.SortAlgo - Element [1] = 1
  343 [main] INFO examples.Sort - The next log statement should be an error message.
  346 [main] ERROR examples.SortAlgo - Tried to dump an uninitialized array.
  at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
  at org.log4j.examples.Sort.main(Sort.java:64)
  467 [main] INFO  examples.Sort - Exiting main method.
 

Author:
Ceki Gülcü

Field Summary
static java.lang.String LINE_SEPARATOR
           
 
Method Summary
 void debug(Marker marker, java.lang.String msg)
          Log a message with the specific Marker at the DEBUG level.
 void debug(Marker marker, java.lang.String format, java.lang.Object arg)
          This method is similar to debug(String, Object) method except that the marker data is also taken into consideration.
 void debug(Marker marker, java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          This method is similar to debug(String, Object, Object) method except that the marker data is also taken into consideration.
 void debug(Marker marker, java.lang.String msg, java.lang.Throwable t)
          This method is similar to debug(String, Throwable) method except that the marker data is also taken into consideration.
 void debug(java.lang.String msg)
          A NOP implementation, as this logger is permanently disabled for the DEBUG level.
 void debug(java.lang.String format, java.lang.Object param1)
          A NOP implementation, as this logger is permanently disabled for the DEBUG level.
 void debug(java.lang.String format, java.lang.Object[] argArray)
          Log a message at the DEBUG level according to the specified format and arguments.
 void debug(java.lang.String format, java.lang.Object param1, java.lang.Object param2)
          A NOP implementation, as this logger is permanently disabled for the DEBUG level.
 void debug(java.lang.String msg, java.lang.Throwable t)
          A NOP implementation, as this logger is permanently disabled for the DEBUG level.
 void error(Marker marker, java.lang.String msg)
          Log a message with the specific Marker at the ERROR level.
 void error(Marker marker, java.lang.String format, java.lang.Object arg)
          This method is similar to error(String, Object) method except that the marker data is also taken into consideration.
 void error(Marker marker, java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          This method is similar to error(String, Object, Object) method except that the marker data is also taken into consideration.
 void error(Marker marker, java.lang.String msg, java.lang.Throwable t)
          This method is similar to error(String, Throwable) method except that the marker data is also taken into consideration.
 void error(java.lang.String msg)
          A simple implementation which always logs messages of level ERROR acoording to the format outlined above.
 void error(java.lang.String format, java.lang.Object arg)
          Perform single parameter substituion before logging the message of level ERROR according to the format outlined above.
 void error(java.lang.String format, java.lang.Object[] argArray)
          Perform double parameter substituion before logging the message of level WARN according to the format outlined above.
 void error(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          Perform double parameter substituion before logging the message of level ERROR according to the format outlined above.
 void error(java.lang.String msg, java.lang.Throwable t)
          Log a message of level ERROR, including an exception.
 java.lang.String getName()
          Return the name of this Logger instance.
 void info(Marker marker, java.lang.String msg)
          Log a message with the specific Marker at the INFO level.
 void info(Marker marker, java.lang.String format, java.lang.Object arg)
          This method is similar to info(String, Object) method except that the marker data is also taken into consideration.
 void info(Marker marker, java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          This method is similar to info(String, Object, Object) method except that the marker data is also taken into consideration.
 void info(Marker marker, java.lang.String msg, java.lang.Throwable t)
          This method is similar to info(String, Throwable) method except that the marker data is also taken into consideration.
 void info(java.lang.String msg)
          A simple implementation which always logs messages of level INFO according to the format outlined above.
 void info(java.lang.String format, java.lang.Object arg)
          Perform single parameter substituion before logging the message of level INFO according to the format outlined above.
 void info(java.lang.String format, java.lang.Object[] argArray)
          Perform double parameter substituion before logging the message of level INFO according to the format outlined above.
 void info(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          Perform double parameter substituion before logging the message of level INFO according to the format outlined above.
 void info(java.lang.String msg, java.lang.Throwable t)
          Log a message of level INFO, including an exception.
 boolean isDebugEnabled()
          Always returns false.
 boolean isDebugEnabled(Marker marker)
          Always returns false.
 boolean isErrorEnabled()
          Always returns true.
 boolean isErrorEnabled(Marker marker)
          Always returns true.
 boolean isInfoEnabled()
          Always returns true.
 boolean isInfoEnabled(Marker marker)
          Always returns true.
 boolean isWarnEnabled()
          Always returns true.
 boolean isWarnEnabled(Marker marker)
          Always returns true.
 void warn(Marker marker, java.lang.String msg)
          Log a message with the specific Marker at the WARN level.
 void warn(Marker marker, java.lang.String format, java.lang.Object arg)
          This method is similar to warn(String, Object) method except that the marker data is also taken into consideration.
 void warn(Marker marker, java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          This method is similar to warn(String, Object, Object) method except that the marker data is also taken into consideration.
 void warn(Marker marker, java.lang.String msg, java.lang.Throwable t)
          This method is similar to warn(String, Throwable) method except that the marker data is also taken into consideration.
 void warn(java.lang.String msg)
          A simple implementation which always logs messages of level WARN according to the format outlined above.
 void warn(java.lang.String format, java.lang.Object arg)
          Perform single parameter substituion before logging the message of level WARN according to the format outlined above.
 void warn(java.lang.String format, java.lang.Object[] argArray)
          Perform double parameter substituion before logging the message of level WARN according to the format outlined above.
 void warn(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
          Perform double parameter substituion before logging the message of level WARN according to the format outlined above.
 void warn(java.lang.String msg, java.lang.Throwable t)
          Log a message of level WARN, including an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SEPARATOR

public static final java.lang.String LINE_SEPARATOR
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Logger
Return the name of this Logger instance.

Specified by:
getName in interface Logger

isDebugEnabled

public boolean isDebugEnabled()
Always returns false.

Specified by:
isDebugEnabled in interface Logger
Returns:
always false

isDebugEnabled

public boolean isDebugEnabled(Marker marker)
Always returns false.

Specified by:
isDebugEnabled in interface MarkingLogger
Parameters:
marker - The marker data to take into consideration
Returns:
always false

debug

public void debug(java.lang.String msg)
A NOP implementation, as this logger is permanently disabled for the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
msg - the message string to be logged

debug

public void debug(java.lang.String format,
                  java.lang.Object param1)
A NOP implementation, as this logger is permanently disabled for the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
format - the format string
param1 - the argument

debug

public void debug(java.lang.String format,
                  java.lang.Object param1,
                  java.lang.Object param2)
A NOP implementation, as this logger is permanently disabled for the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
format - the format string
param1 - the first argument
param2 - the second argument

debug

public void debug(java.lang.String format,
                  java.lang.Object[] argArray)
Description copied from interface: Logger
Log a message at the DEBUG level according to the specified format and arguments.

This form avoids superfluous object creation when the logger is disabled for the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
format - the format string
argArray - an array of arguments

debug

public void debug(java.lang.String msg,
                  java.lang.Throwable t)
A NOP implementation, as this logger is permanently disabled for the DEBUG level.

Specified by:
debug in interface Logger
Parameters:
msg - the message accompanying the exception
t - the exception (throwable) to log

debug

public void debug(Marker marker,
                  java.lang.String msg)
Description copied from interface: MarkingLogger
Log a message with the specific Marker at the DEBUG level.

Specified by:
debug in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
msg - the message string to be logged

debug

public void debug(Marker marker,
                  java.lang.String format,
                  java.lang.Object arg)
Description copied from interface: MarkingLogger
This method is similar to Logger.debug(String, Object) method except that the marker data is also taken into consideration.

Specified by:
debug in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg - the argument

debug

public void debug(Marker marker,
                  java.lang.String format,
                  java.lang.Object arg1,
                  java.lang.Object arg2)
Description copied from interface: MarkingLogger
This method is similar to Logger.debug(String, Object, Object) method except that the marker data is also taken into consideration.

Specified by:
debug in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg1 - the first argument
arg2 - the second argument

debug

public void debug(Marker marker,
                  java.lang.String msg,
                  java.lang.Throwable t)
Description copied from interface: MarkingLogger
This method is similar to Logger.debug(String, Throwable) method except that the marker data is also taken into consideration.

Specified by:
debug in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
msg - the message accompanying the exception
t - the exception (throwable) to log

isInfoEnabled

public boolean isInfoEnabled()
Always returns true.

Specified by:
isInfoEnabled in interface Logger
Returns:
True if this Logger is enabled for the INFO level, false otherwise.

isInfoEnabled

public boolean isInfoEnabled(Marker marker)
Always returns true.

Specified by:
isInfoEnabled in interface MarkingLogger
Parameters:
marker - The marker data to take into consideration

info

public void info(java.lang.String msg)
A simple implementation which always logs messages of level INFO according to the format outlined above.

Specified by:
info in interface Logger
Parameters:
msg - the message string to be logged

info

public void info(java.lang.String format,
                 java.lang.Object arg)
Perform single parameter substituion before logging the message of level INFO according to the format outlined above.

Specified by:
info in interface Logger
Parameters:
format - the format string
arg - the argument

info

public void info(java.lang.String format,
                 java.lang.Object arg1,
                 java.lang.Object arg2)
Perform double parameter substituion before logging the message of level INFO according to the format outlined above.

Specified by:
info in interface Logger
Parameters:
format - the format string
arg1 - the first argument
arg2 - the second argument

info

public void info(java.lang.String format,
                 java.lang.Object[] argArray)
Perform double parameter substituion before logging the message of level INFO according to the format outlined above.

Specified by:
info in interface Logger
Parameters:
format - the format string
argArray - an array of arguments

info

public void info(java.lang.String msg,
                 java.lang.Throwable t)
Log a message of level INFO, including an exception.

Specified by:
info in interface Logger
Parameters:
msg - the message accompanying the exception
t - the exception (throwable) to log

info

public void info(Marker marker,
                 java.lang.String msg)
Description copied from interface: MarkingLogger
Log a message with the specific Marker at the INFO level.

Specified by:
info in interface MarkingLogger
Parameters:
marker - The marker specific to this log statement
msg - the message string to be logged

info

public void info(Marker marker,
                 java.lang.String format,
                 java.lang.Object arg)
Description copied from interface: MarkingLogger
This method is similar to Logger.info(String, Object) method except that the marker data is also taken into consideration.

Specified by:
info in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg - the argument

info

public void info(Marker marker,
                 java.lang.String format,
                 java.lang.Object arg1,
                 java.lang.Object arg2)
Description copied from interface: MarkingLogger
This method is similar to Logger.info(String, Object, Object) method except that the marker data is also taken into consideration.

Specified by:
info in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg1 - the first argument
arg2 - the second argument

info

public void info(Marker marker,
                 java.lang.String msg,
                 java.lang.Throwable t)
Description copied from interface: MarkingLogger
This method is similar to Logger.info(String, Throwable) method except that the marker data is also taken into consideration.

Specified by:
info in interface MarkingLogger
Parameters:
marker - the marker data for this log statement
msg - the message accompanying the exception
t - the exception (throwable) to log

isWarnEnabled

public boolean isWarnEnabled()
Always returns true.

Specified by:
isWarnEnabled in interface Logger
Returns:
True if this Logger is enabled for the WARN level, false otherwise.

isWarnEnabled

public boolean isWarnEnabled(Marker marker)
Always returns true.

Specified by:
isWarnEnabled in interface MarkingLogger
Parameters:
marker - The marker data to take into consideration

warn

public void warn(java.lang.String msg)
A simple implementation which always logs messages of level WARN according to the format outlined above.

Specified by:
warn in interface Logger
Parameters:
msg - the message string to be logged

warn

public void warn(java.lang.String format,
                 java.lang.Object arg)
Perform single parameter substituion before logging the message of level WARN according to the format outlined above.

Specified by:
warn in interface Logger
Parameters:
format - the format string
arg - the argument

warn

public void warn(java.lang.String format,
                 java.lang.Object arg1,
                 java.lang.Object arg2)
Perform double parameter substituion before logging the message of level WARN according to the format outlined above.

Specified by:
warn in interface Logger
Parameters:
format - the format string
arg1 - the first argument
arg2 - the second argument

warn

public void warn(java.lang.String format,
                 java.lang.Object[] argArray)
Perform double parameter substituion before logging the message of level WARN according to the format outlined above.

Specified by:
warn in interface Logger
Parameters:
format - the format string
argArray - an array of arguments

warn

public void warn(java.lang.String msg,
                 java.lang.Throwable t)
Log a message of level WARN, including an exception.

Specified by:
warn in interface Logger
Parameters:
msg - the message accompanying the exception
t - the exception (throwable) to log

warn

public void warn(Marker marker,
                 java.lang.String msg)
Description copied from interface: MarkingLogger
Log a message with the specific Marker at the WARN level.

Specified by:
warn in interface MarkingLogger
Parameters:
marker - The marker specific to this log statement
msg - the message string to be logged

warn

public void warn(Marker marker,
                 java.lang.String format,
                 java.lang.Object arg)
Description copied from interface: MarkingLogger
This method is similar to Logger.warn(String, Object) method except that the marker data is also taken into consideration.

Specified by:
warn in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg - the argument

warn

public void warn(Marker marker,
                 java.lang.String format,
                 java.lang.Object arg1,
                 java.lang.Object arg2)
Description copied from interface: MarkingLogger
This method is similar to Logger.warn(String, Object, Object) method except that the marker data is also taken into consideration.

Specified by:
warn in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg1 - the first argument
arg2 - the second argument

warn

public void warn(Marker marker,
                 java.lang.String msg,
                 java.lang.Throwable t)
Description copied from interface: MarkingLogger
This method is similar to Logger.warn(String, Throwable) method except that the marker data is also taken into consideration.

Specified by:
warn in interface MarkingLogger
Parameters:
marker - the marker data for this log statement
msg - the message accompanying the exception
t - the exception (throwable) to log

isErrorEnabled

public boolean isErrorEnabled()
Always returns true.

Specified by:
isErrorEnabled in interface Logger
Returns:
True if this Logger is enabled for the ERROR level, false otherwise.

isErrorEnabled

public boolean isErrorEnabled(Marker marker)
Always returns true.

Specified by:
isErrorEnabled in interface MarkingLogger
Parameters:
marker - The marker data to take into consideration

error

public void error(java.lang.String msg)
A simple implementation which always logs messages of level ERROR acoording to the format outlined above.

Specified by:
error in interface Logger
Parameters:
msg - the message string to be logged

error

public void error(java.lang.String format,
                  java.lang.Object arg)
Perform single parameter substituion before logging the message of level ERROR according to the format outlined above.

Specified by:
error in interface Logger
Parameters:
format - the format string
arg - the argument

error

public void error(java.lang.String format,
                  java.lang.Object arg1,
                  java.lang.Object arg2)
Perform double parameter substituion before logging the message of level ERROR according to the format outlined above.

Specified by:
error in interface Logger
Parameters:
format - the format string
arg1 - the first argument
arg2 - the second argument

error

public void error(java.lang.String format,
                  java.lang.Object[] argArray)
Perform double parameter substituion before logging the message of level WARN according to the format outlined above.

Specified by:
error in interface Logger
Parameters:
format - the format string
argArray - an array of arguments

error

public void error(java.lang.String msg,
                  java.lang.Throwable t)
Log a message of level ERROR, including an exception.

Specified by:
error in interface Logger
Parameters:
msg - the message accompanying the exception
t - the exception (throwable) to log

error

public void error(Marker marker,
                  java.lang.String msg)
Description copied from interface: MarkingLogger
Log a message with the specific Marker at the ERROR level.

Specified by:
error in interface MarkingLogger
Parameters:
marker - The marker specific to this log statement
msg - the message string to be logged

error

public void error(Marker marker,
                  java.lang.String format,
                  java.lang.Object arg)
Description copied from interface: MarkingLogger
This method is similar to Logger.error(String, Object) method except that the marker data is also taken into consideration.

Specified by:
error in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg - the argument

error

public void error(Marker marker,
                  java.lang.String format,
                  java.lang.Object arg1,
                  java.lang.Object arg2)
Description copied from interface: MarkingLogger
This method is similar to Logger.error(String, Object, Object) method except that the marker data is also taken into consideration.

Specified by:
error in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
format - the format string
arg1 - the first argument
arg2 - the second argument

error

public void error(Marker marker,
                  java.lang.String msg,
                  java.lang.Throwable t)
Description copied from interface: MarkingLogger
This method is similar to Logger.error(String, Throwable) method except that the marker data is also taken into consideration.

Specified by:
error in interface MarkingLogger
Parameters:
marker - the marker data specific to this log statement
msg - the message accompanying the exception
t - the exception (throwable) to log

Copyright 2004-2006 SLF4J.ORG, QOS.ch