uk.me.parabola.log
Class Logger

java.lang.Object
  extended by uk.me.parabola.log.Logger

public class Logger
extends java.lang.Object

Simple logging class. By default it is disabled. You have to set it up using (currently) a system property. On the other hand it uses varargs to make easier logging without having to do string concatenation in the regular code.

Author:
Steve Ratcliffe

Method Summary
 void debug(java.lang.Object... olist)
          Log a message that consists of a variable number of arguments.
 void debug(java.lang.Object o)
          Debug message.
 void error(java.lang.Object o)
           
 void error(java.lang.Object o, java.lang.Throwable e)
           
static Logger getLogger(java.lang.Class<?> aClass)
          Convenience class to get a logger using a class name as the name.
 void info(java.lang.Object... olist)
           
 void info(java.lang.Object o)
           
 boolean isDebugEnabled()
           
 boolean isErrorEnabled()
           
 boolean isInfoEnabled()
           
 boolean isLoggable(java.util.logging.Level level)
           
 boolean isWarnEnabled()
           
 void log(java.util.logging.Level level, java.lang.Object... olist)
           
 void log(java.util.logging.Level level, java.lang.Object o)
           
static void resetLogging(java.lang.String filename)
           
 java.lang.String threadTag()
           
 void threadTag(java.lang.String tag)
           
 void warn(java.lang.Object... olist)
           
 void warn(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static Logger getLogger(java.lang.Class<?> aClass)
Convenience class to get a logger using a class name as the name.

Parameters:
aClass - The class - its name will be used to retrieve the logger.
Returns:
The logger.

resetLogging

public static void resetLogging(java.lang.String filename)

isLoggable

public boolean isLoggable(java.util.logging.Level level)

isDebugEnabled

public boolean isDebugEnabled()

isInfoEnabled

public boolean isInfoEnabled()

isWarnEnabled

public boolean isWarnEnabled()

isErrorEnabled

public boolean isErrorEnabled()

debug

public void debug(java.lang.Object o)
Debug message. We are using the j.u.l FINE level for this. As it is possible that the toString method on the logged object is expensive we check that the message should be logged first. Though this is perhaps overkill. This comment applies to all the corresponding methods below.

Parameters:
o - The object to be logged.

debug

public void debug(java.lang.Object... olist)
Log a message that consists of a variable number of arguments. The arguments are simply concatenated with a space between them. The arrayFormat call is very expensive and checking the log level first is important. The same applies to all similar routines below.

Parameters:
olist - The list of objects to log as one message.

info

public void info(java.lang.Object o)

info

public void info(java.lang.Object... olist)

warn

public void warn(java.lang.Object o)

warn

public void warn(java.lang.Object... olist)

error

public void error(java.lang.Object o)

error

public void error(java.lang.Object o,
                  java.lang.Throwable e)

log

public void log(java.util.logging.Level level,
                java.lang.Object o)

log

public void log(java.util.logging.Level level,
                java.lang.Object... olist)

threadTag

public void threadTag(java.lang.String tag)

threadTag

public java.lang.String threadTag()