net.sourceforge.stripes.util
Class Log

java.lang.Object
  extended by net.sourceforge.stripes.util.Log

public final class Log
extends Object

A wafer thin wrapper around Commons logging that uses var-args to make it much more efficient to call the logging methods in commons logging without having to surround every call site with calls to Log.isXXXEnabled(). All the methods on this class take a variable length list of arguments and, only if logging is enabled for the level and channel being logged to, will those arguments be toString()'d and appended together.

Author:
Tim Fennell

Method Summary
static void cleanup()
          Forces Log to cleanup any cached resources.
 void debug(Object... messageParts)
          Logs one or more message parts at level debug.
 void debug(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level debug.
 void error(Object... messageParts)
          Logs one or more message parts at level error.
 void error(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level error.
 void fatal(Object... messageParts)
          Logs one or more message parts at level fatal.
 void fatal(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level fatal.
static Log getInstance(Class<?> clazz)
          Get a Log instance to perform logging within the Class specified.
 Log getRealLog()
           
 void info(Object... messageParts)
          Logs one or more message parts at level info.
 void info(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level info.
 void trace(Object... messageParts)
          Logs one or more message parts at level trace.
 void trace(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level trace.
 void warn(Object... messageParts)
          Logs one or more message parts at level warn.
 void warn(Throwable throwable, Object... messageParts)
          Logs a Throwable and optional message parts at level warn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRealLog

public Log getRealLog()

getInstance

public static Log getInstance(Class<?> clazz)
Get a Log instance to perform logging within the Class specified. Returns an instance of this class which wraps an instance of the commons logging Log class.

Parameters:
clazz - the Class which is going to be doing the logging
Returns:
a Log instance with which to log

cleanup

public static void cleanup()
Forces Log to cleanup any cached resources. This is called by the StripesFilter when it is destroyed, but can be called from user code as well if necessary.


fatal

public final void fatal(Throwable throwable,
                        Object... messageParts)
Logs a Throwable and optional message parts at level fatal.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

error

public final void error(Throwable throwable,
                        Object... messageParts)
Logs a Throwable and optional message parts at level error.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

warn

public final void warn(Throwable throwable,
                       Object... messageParts)
Logs a Throwable and optional message parts at level warn.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

info

public final void info(Throwable throwable,
                       Object... messageParts)
Logs a Throwable and optional message parts at level info.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

debug

public final void debug(Throwable throwable,
                        Object... messageParts)
Logs a Throwable and optional message parts at level debug.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

trace

public final void trace(Throwable throwable,
                        Object... messageParts)
Logs a Throwable and optional message parts at level trace.

Parameters:
throwable - an instance of Throwable that should be logged with stack trace
messageParts - zero or more objects which should be combined, by calling toString() to form the log message.

fatal

public final void fatal(Object... messageParts)
Logs one or more message parts at level fatal.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.

error

public final void error(Object... messageParts)
Logs one or more message parts at level error.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.

warn

public final void warn(Object... messageParts)
Logs one or more message parts at level warn.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.

info

public final void info(Object... messageParts)
Logs one or more message parts at level info.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.

debug

public final void debug(Object... messageParts)
Logs one or more message parts at level debug.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.

trace

public final void trace(Object... messageParts)
Logs one or more message parts at level trace.

Parameters:
messageParts - one or more objects which should be combined, by calling toString() to form the log message.


? Copyright 2005-2006, Stripes Development Team.