org.mmbase.util.logging
Class LoggerWrapper

java.lang.Object
  extended byorg.mmbase.util.logging.LoggerWrapper
All Implemented Interfaces:
Logger

public class LoggerWrapper
extends Object
implements Logger

Wraps a logger instance. This can be used for static logger instances which might be instatatied before logging itself is configured. After configurating logging, all static 'wrappers' can then be called to wrap another logger instance.

Since:
MMBase-1.7
Version:
$Id: LoggerWrapper.java,v 1.5 2006/02/28 12:16:53 nklasens Exp $
Author:
Michiel Meeuwissen

Method Summary
 void debug(Object m)
          Logs the message m with debug priority.
 void debug(Object m, Throwable t)
           
 void error(Object m)
          Logs the message m with error priority.
 void error(Object m, Throwable t)
           
 void fatal(Object m)
          Logs the message m with fatal priority.
 void fatal(Object m, Throwable t)
           
 void info(Object m)
          Logs the message m with info priority.
 void info(Object m, Throwable t)
           
 boolean isDebugEnabled()
          Returns true if for this category (Logger), a call to debug (or trace) would do something.
 boolean isServiceEnabled()
          Returns true if for this category (Logger), a call to service (or debug or trace) would do something.
 boolean isTraceEnabled()
          Returns true if for this category (Logger), a call to trace would do something.
 void service(Object m)
          Logs the message m with service priority.
 void service(Object m, Throwable t)
           
 void setLevel(Level p)
          If you want to override the level in the configuration file fixed for this category, you can do it with this method.
 void trace(Object m)
          Logs the message m with trace priority.
 void trace(Object m, Throwable t)
           
 void warn(Object m)
          Logs the message m with warn priority.
 void warn(Object m, Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

trace

public final void trace(Object m)
Description copied from interface: Logger
Logs the message m with trace priority. For detailled debugging.

Specified by:
trace in interface Logger
See Also:
Logger.debug(Object)

trace

public final void trace(Object m,
                        Throwable t)
Specified by:
trace in interface Logger

debug

public final void debug(Object m)
Description copied from interface: Logger
Logs the message m with debug priority. Everything a non-developer never wants to see, but you do, to * keep track of what is happening. There can be a lot of them in the code, so it is important that you well protect them with `isDebugEnabled's, to minimize overhead.

Specified by:
debug in interface Logger

debug

public final void debug(Object m,
                        Throwable t)
Specified by:
debug in interface Logger

service

public final void service(Object m)
Description copied from interface: Logger
Logs the message m with service priority. An interested system administrator might want to see these things. For examples all queries to the database could be logged with `service' priority. Or if a image is calculated, that could be logged as a `service'. One would get a fairly good idea what MMBase is doing if `service' is switched on.

Specified by:
service in interface Logger

service

public final void service(Object m,
                          Throwable t)
Specified by:
service in interface Logger

info

public final void info(Object m)
Description copied from interface: Logger
Logs the message m with info priority. As `service', but focussed on things system administrators are usually most interested in, like authorisation issues. For example changes on the database could be logged, such that one can see in the logs what happened.

Specified by:
info in interface Logger

info

public final void info(Object m,
                       Throwable t)
Specified by:
info in interface Logger

warn

public final void warn(Object m)
Description copied from interface: Logger
Logs the message m with warn priority. Something strange happened, but it is not necessarily an error.

Specified by:
warn in interface Logger

warn

public final void warn(Object m,
                       Throwable t)
Specified by:
warn in interface Logger

error

public final void error(Object m)
Description copied from interface: Logger
Logs the message m with error priority. Something is definitely wrong. An inconsistency was detected. It might be unpredictable what will happen.

Specified by:
error in interface Logger

error

public final void error(Object m,
                        Throwable t)
Specified by:
error in interface Logger

fatal

public final void fatal(Object m)
Description copied from interface: Logger
Logs the message m with fatal priority. The progam could not function any more. Normally, you would throw an exception, which then will be logged with fatal priority. I've made an arangement in `Logger' that logs uncatched exceptions with fatal priority, but nevertheless it's better to always catch all exceptions in a more regulated way.

Specified by:
fatal in interface Logger

fatal

public final void fatal(Object m,
                        Throwable t)
Specified by:
fatal in interface Logger

isTraceEnabled

public final boolean isTraceEnabled()
Description copied from interface: Logger
Returns true if for this category (Logger), a call to trace would do something.

Specified by:
isTraceEnabled in interface Logger

isDebugEnabled

public final boolean isDebugEnabled()
Description copied from interface: Logger
Returns true if for this category (Logger), a call to debug (or trace) would do something.

Specified by:
isDebugEnabled in interface Logger

isServiceEnabled

public final boolean isServiceEnabled()
Description copied from interface: Logger
Returns true if for this category (Logger), a call to service (or debug or trace) would do something.

Specified by:
isServiceEnabled in interface Logger

setLevel

public final void setLevel(Level p)
Description copied from interface: Logger
If you want to override the level in the configuration file fixed for this category, you can do it with this method. This could be usefull for example to switch on all debug logging when something has gone wrong.

Specified by:
setLevel in interface Logger
Parameters:
p - The level of the priority. One of the constants Level.TRACE, Level.DEBUG, Level.SERVICE, Level.INFO, Level.WARN, Level.ERROR or Level.FATAL.


MMBase build 1.8.1.20060716