org.sakaiproject.service.framework.log
Interface Logger

All Known Implementing Classes:
CommonsLogger

public interface Logger

Logger is a simple, single log destination interface for program events logging.

This interface is function compatible with the concepts of the Apache Jakarta Commons Loging Log class (org.apache.commons.logging.Log version 1.0.3)

Log messages are classified with a type. Types are ordered, from least sever to most sever:

  1. trace
  2. debug
  3. info
  4. warn
  5. error
  6. fatal
Logging can be enabled above a certain severity type, disabled below. For example, if logging is set to "warn", all "warn", "error" and "fatal" messages will be logged; "info", "debug" and "trace" messages will be ignored.

It's best practice to guard all logging calls with an "enabled test". The extra time spent on the test will be recovered in production when the logging level is disabled. The parameter preparation cost of the log call which may be high, will be avoided when the level is disabled and guarding is used. A guarded log call looks like:
if (Logger.isDebugEnabled() Logger.Debug("a message");

Version:
$Revision: 632 $
Author:
University of Michigan, Sakai Software Development Team

Method Summary
 void debug(Object message)
          Log a "debug" type message.
 void debug(Object message, Throwable t)
          Log a "debug" type message.
 void error(Object message)
          Log a "error" type message.
 void error(Object message, Throwable t)
          Log a "error" type message.
 void fatal(Object message)
          Log a "fatal" type message.
 void fatal(Object message, Throwable t)
          Log a "fatal" type message.
 void info(Object message)
          Log a "info" type message.
 void info(Object message, Throwable t)
          Log a "info" type message.
 boolean isDebugEnabled()
          Check if the logger's enabled level includes generation of "debug" type messages.
 boolean isErrorEnabled()
          Check if the logger's enabled level includes generation of "error" type messages.
 boolean isFatalEnabled()
          Check if the logger's enabled level includes generation of "fatal" type messages.
 boolean isInfoEnabled()
          Check if the logger's enabled level includes generation of "info" type messages.
 boolean isTraceEnabled()
          Check if the logger's enabled level includes generation of "trace" type messages.
 boolean isWarnEnabled()
          Check if the logger's enabled level includes generation of "warn" type messages.
 void trace(Object message)
          Log a "trace" type message.
 void trace(Object message, Throwable t)
          Log a "trace" type message.
 void warn(Object message)
          Log a "warn" type message.
 void warn(Object message, Throwable t)
          Log a "warn" type message.
 

Method Detail

isTraceEnabled

public boolean isTraceEnabled()
Check if the logger's enabled level includes generation of "trace" type messages.

Returns:
true if trace logging is currently enabled, false if not.

isDebugEnabled

public boolean isDebugEnabled()
Check if the logger's enabled level includes generation of "debug" type messages.

Returns:
true if debug logging is currently enabled, false if not.

isInfoEnabled

public boolean isInfoEnabled()
Check if the logger's enabled level includes generation of "info" type messages.

Returns:
true if info logging is currently enabled, false if not.

isWarnEnabled

public boolean isWarnEnabled()
Check if the logger's enabled level includes generation of "warn" type messages.

Returns:
true if warn logging is currently enabled, false if not.

isErrorEnabled

public boolean isErrorEnabled()
Check if the logger's enabled level includes generation of "error" type messages.

Returns:
true if error logging is currently enabled, false if not.

isFatalEnabled

public boolean isFatalEnabled()
Check if the logger's enabled level includes generation of "fatal" type messages.

Returns:
true if fatal logging is currently enabled, false if not.

trace

public void trace(Object message)
Log a "trace" type message.

Parameters:
message - The message to log.

trace

public void trace(Object message,
                  Throwable t)
Log a "trace" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.

debug

public void debug(Object message)
Log a "debug" type message.

Parameters:
message - The message to log.

debug

public void debug(Object message,
                  Throwable t)
Log a "debug" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.

info

public void info(Object message)
Log a "info" type message.

Parameters:
message - The message to log.

info

public void info(Object message,
                 Throwable t)
Log a "info" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.

warn

public void warn(Object message)
Log a "warn" type message.

Parameters:
message - The message to log.

warn

public void warn(Object message,
                 Throwable t)
Log a "warn" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.

error

public void error(Object message)
Log a "error" type message.

Parameters:
message - The message to log.

error

public void error(Object message,
                  Throwable t)
Log a "error" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.

fatal

public void fatal(Object message)
Log a "fatal" type message.

Parameters:
message - The message to log.

fatal

public void fatal(Object message,
                  Throwable t)
Log a "fatal" type message.

Parameters:
message - The message to log.
t - The throwable to add to the message in the log.