Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* 
   * Copyright (c) 2004-2008 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;

The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that logging takes place through concrete implementations of this interface.

Typical usage pattern:

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class Wombat {

   final static Logger logger = LoggerFactory.getLogger(Wombat.class);
   Integer t;
   Integer oldT;

   public void setTemperature(Integer temperature) {
     oldT = t;        
     t = temperature;
     logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);
     if(temperature.intValue() > 50) {
       logger.info("Temperature has risen above 50 degrees.");
     }
   }
 }

Author(s):
Ceki Gülcü
 
 public interface Logger {


  
Case insensitive String constant used to retrieve the name of the root logger.

Since:
1.3
 
   final public String ROOT_LOGGER_NAME = "ROOT";
  
  
Return the name of this Logger instance.
 
   public String getName();

  
Is the logger instance enabled for the TRACE level?

Returns:
True if this Logger is enabled for the TRACE level, false otherwise.
Since:
1.4
 
   public boolean isTraceEnabled();
    

  
Log a message at the TRACE level.

Parameters:
msg the message string to be logged
Since:
1.4
 
   public void trace(String msg);

  
  
Log a message at the TRACE level according to the specified format and argument.

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

Parameters:
format the format string
arg the argument
Since:
1.4
  public void trace(String formatObject arg);


   
  
Log a message at the TRACE level according to the specified format and arguments.

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

Parameters:
format the format string
arg1 the first argument
arg2 the second argument
Since:
1.4
  public void trace(String formatObject arg1Object arg2);

  
Log a message at the TRACE level according to the specified format and arguments.

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

Parameters:
format the format string
argArray an array of arguments
Since:
1.4
  public void trace(String formatObject[] argArray);
  
  
Log an exception (throwable) at the TRACE level with an accompanying message.

Parameters:
msg the message accompanying the exception
t the exception (throwable) to log
Since:
1.4
 
  public void trace(String msgThrowable t);
 
  
  
Similar to isTraceEnabled() method except that the marker data is also taken into account.

Parameters:
marker The marker data to take into consideration
Since:
1.4
  public boolean isTraceEnabled(Marker marker);
  
  
Log a message with the specific Marker at the TRACE level.

Parameters:
marker the marker data specific to this log statement
msg the message string to be logged
Since:
1.4
  public void trace(Marker markerString msg);
  
  
This method is similar to trace(java.lang.String,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg the argument
Since:
1.4
  public void trace(Marker markerString formatObject arg);
 
 
  
This method is similar to trace(java.lang.String,java.lang.Object,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg1 the first argument
arg2 the second argument
Since:
1.4
  public void trace(Marker markerString formatObject arg1Object arg2);

  
This method is similar to trace(java.lang.String,java.lang.Object[]) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
argArray an array of arguments
Since:
1.4
  public void trace(Marker markerString formatObject[] argArray);

  
  
This method is similar to trace(java.lang.String,java.lang.Throwable) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
msg the message accompanying the exception
t the exception (throwable) to log
Since:
1.4
 
  public void trace(Marker markerString msgThrowable t);

  
  
Is the logger instance enabled for the DEBUG level?

Returns:
True if this Logger is enabled for the DEBUG level, false otherwise.
  public boolean isDebugEnabled();
  
  
  
Log a message at the DEBUG level.

Parameters:
msg the message string to be logged
  public void debug(String msg);
  
  
  
Log a message at the DEBUG level according to the specified format and argument.

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

Parameters:
format the format string
arg the argument
  public void debug(String formatObject arg);


  
  
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.

Parameters:
format the format string
arg1 the first argument
arg2 the second argument
  public void debug(String formatObject arg1Object arg2);

  
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.

Parameters:
format the format string
argArray an array of arguments
  public void debug(String formatObject[] argArray);
  
  
Log an exception (throwable) at the DEBUG level with an accompanying message.

Parameters:
msg the message accompanying the exception
t the exception (throwable) to log
 
  public void debug(String msgThrowable t);
 
  
  
Similar to isDebugEnabled() method except that the marker data is also taken into account.

Parameters:
marker The marker data to take into consideration
  public boolean isDebugEnabled(Marker marker);
  
  
Log a message with the specific Marker at the DEBUG level.

Parameters:
marker the marker data specific to this log statement
msg the message string to be logged
  public void debug(Marker markerString msg);
  
  
This method is similar to debug(java.lang.String,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg the argument
  public void debug(Marker markerString formatObject arg);
 
 
  
This method is similar to debug(java.lang.String,java.lang.Object,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg1 the first argument
arg2 the second argument
  public void debug(Marker markerString formatObject arg1Object arg2);

  
This method is similar to debug(java.lang.String,java.lang.Object[]) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
argArray an array of arguments
  public void debug(Marker markerString formatObject[] argArray);

  
  
This method is similar to debug(java.lang.String,java.lang.Throwable) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
msg the message accompanying the exception
t the exception (throwable) to log
 
  public void debug(Marker markerString msgThrowable t);
  
  
  
Is the logger instance enabled for the INFO level?

Returns:
True if this Logger is enabled for the INFO level, false otherwise.
  public boolean isInfoEnabled();

  
  
Log a message at the INFO level.

Parameters:
msg the message string to be logged
  public void info(String msg);
  

  
Log a message at the INFO level according to the specified format and argument.

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

Parameters:
format the format string
arg the argument
  public void info(String formatObject arg);

  
  
Log a message at the INFO level according to the specified format and arguments.

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

Parameters:
format the format string
arg1 the first argument
arg2 the second argument
  public void info(String formatObject arg1Object arg2);

  
Log a message at the INFO level according to the specified format and arguments.

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

Parameters:
format the format string
argArray an array of arguments
  public void info(String formatObject[] argArray);
  
  
Log an exception (throwable) at the INFO level with an accompanying message.

Parameters:
msg the message accompanying the exception
t the exception (throwable) to log
  public void info(String msgThrowable t);

  
Similar to isInfoEnabled() method except that the marker data is also taken into consideration.

Parameters:
marker The marker data to take into consideration
  public boolean isInfoEnabled(Marker marker);
  
  
Log a message with the specific Marker at the INFO level.

Parameters:
marker The marker specific to this log statement
msg the message string to be logged
  public void info(Marker markerString msg);
  
  
This method is similar to info(java.lang.String,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg the argument
  public void info(Marker markerString formatObject arg);
  
  
This method is similar to info(java.lang.String,java.lang.Object,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg1 the first argument
arg2 the second argument
  public void info(Marker markerString formatObject arg1Object arg2);  
  
  
  
This method is similar to info(java.lang.String,java.lang.Object[]) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
argArray an array of arguments
  public void info(Marker markerString formatObject[] argArray);

  
  
This method is similar to info(java.lang.String,java.lang.Throwable) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data for this log statement
msg the message accompanying the exception
t the exception (throwable) to log
 
  public void info(Marker markerString msgThrowable t); 

  
  
Is the logger instance enabled for the WARN level?

Returns:
True if this Logger is enabled for the WARN level, false otherwise.
  public boolean isWarnEnabled();

  
Log a message at the WARN level.

Parameters:
msg the message string to be logged
  public void warn(String msg);

 
Log a message at the WARN level according to the specified format and argument.

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

Parameters:
format the format string
arg the argument
  public void warn(String formatObject arg);

  
  
Log a message at the WARN level according to the specified format and arguments.

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

Parameters:
format the format string
argArray an array of arguments
  public void warn(String formatObject[] argArray);
  
  
Log a message at the WARN level according to the specified format and arguments.

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

Parameters:
format the format string
arg1 the first argument
arg2 the second argument
  public void warn(String formatObject arg1Object arg2);
  
  
Log an exception (throwable) at the WARN level with an accompanying message.

Parameters:
msg the message accompanying the exception
t the exception (throwable) to log
  public void warn(String msgThrowable t);
  

  
Similar to isWarnEnabled() method except that the marker data is also taken into consideration.

Parameters:
marker The marker data to take into consideration
  public boolean isWarnEnabled(Marker marker);
 
  
Log a message with the specific Marker at the WARN level.

Parameters:
marker The marker specific to this log statement
msg the message string to be logged
  public void warn(Marker markerString msg); 
  
  
This method is similar to warn(java.lang.String,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg the argument
  public void warn(Marker markerString formatObject arg);
  
  
This method is similar to warn(java.lang.String,java.lang.Object,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg1 the first argument
arg2 the second argument
  public void warn(Marker markerString formatObject arg1Object arg2);  
  
  
This method is similar to warn(java.lang.String,java.lang.Object[]) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
argArray an array of arguments
  public void warn(Marker markerString formatObject[] argArray);

  
  
This method is similar to warn(java.lang.String,java.lang.Throwable) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data for this log statement
msg the message accompanying the exception
t the exception (throwable) to log
 
  public void warn(Marker markerString msgThrowable t); 
  

  
Is the logger instance enabled for the ERROR level?

Returns:
True if this Logger is enabled for the ERROR level, false otherwise.
  public boolean isErrorEnabled();
  
  
Log a message at the ERROR level.

Parameters:
msg the message string to be logged
  public void error(String msg);
  
 
Log a message at the ERROR level according to the specified format and argument.

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

Parameters:
format the format string
arg the argument
  public void error(String formatObject arg);

  
Log a message at the ERROR level according to the specified format and arguments.

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

Parameters:
format the format string
arg1 the first argument
arg2 the second argument
  public void error(String formatObject arg1Object arg2);

  
Log a message at the ERROR level according to the specified format and arguments.

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

Parameters:
format the format string
argArray an array of arguments
  public void error(String formatObject[] argArray);
  
  
Log an exception (throwable) at the ERROR level with an accompanying message.

Parameters:
msg the message accompanying the exception
t the exception (throwable) to log
  public void error(String msgThrowable t);


  
Similar to isErrorEnabled() method except that the marker data is also taken into consideration.

Parameters:
marker The marker data to take into consideration
  public boolean isErrorEnabled(Marker marker);
  
  
Log a message with the specific Marker at the ERROR level.

Parameters:
marker The marker specific to this log statement
msg the message string to be logged
  public void error(Marker markerString msg); 
  
  
This method is similar to error(java.lang.String,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg the argument
  public void error(Marker markerString formatObject arg);
  
  
This method is similar to error(java.lang.String,java.lang.Object,java.lang.Object) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
arg1 the first argument
arg2 the second argument
  public void error(Marker markerString formatObject arg1Object arg2);  
  
  
This method is similar to error(java.lang.String,java.lang.Object[]) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
format the format string
argArray an array of arguments
  public void error(Marker markerString formatObject[] argArray);

  
  
This method is similar to error(java.lang.String,java.lang.Throwable) method except that the marker data is also taken into consideration.

Parameters:
marker the marker data specific to this log statement
msg the message accompanying the exception
t the exception (throwable) to log
 
  public void error(Marker markerString msgThrowable t);
New to GrepCode? Check out our FAQ X