org.mmbase.util.logging
Class SimpleImpl

java.lang.Object
  |
  +--org.mmbase.util.logging.SimpleImpl
All Implemented Interfaces:
Logger

public class SimpleImpl
extends java.lang.Object
implements Logger

A very simple implementation of Logger. It writes everything to standard output or standard error (the configure string can contain `stderr' or `stdout' (default)). It does not know categories (and therefore is a Singleton class). It is possible to configure what should be logged as well. . and you cannot configure what to log (everything is always logged).

Author:
Michiel Meeuwissen

Method Summary
static void configure(java.lang.String c)
          The configure method of this Logger implemenation.
 void debug(java.lang.Object m)
          Logs the message m with debug priority.
 void error(java.lang.Object m)
          Logs the message m with error priority.
 void fatal(java.lang.Object m)
          Logs the message m with fatal priority.
static SimpleImpl getLoggerInstance(java.lang.String name)
           
 void info(java.lang.Object m)
          Logs the message m with info priority.
 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 (debug or trace) would do something.
 void log(java.lang.String s)
           
 void service(java.lang.Object m)
          Logs the message m with service priority.
 void setPriority(Level p)
          One can change the priority.
 void trace(java.lang.Object m)
          Logs the message m with trace priority.
 void warn(java.lang.Object m)
          Logs the message m with warn priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLoggerInstance

public static SimpleImpl getLoggerInstance(java.lang.String name)

configure

public static void configure(java.lang.String c)
The configure method of this Logger implemenation.
Parameters:
A - string, which can contain the output (stdout or stderr) and the priority (e.g. 'info')

setPriority

public void setPriority(Level p)
One can change the priority.
Specified by:
setPriority in interface Logger
Parameters:
a - Level. For example org.mmbase.util.logging.Level.DEBUG.

log

public final void log(java.lang.String s)

trace

public void trace(java.lang.Object m)
Description copied from interface: Logger
Logs the message m with trace priority. For detailled debugging.
Specified by:
trace in interface Logger
Following copied from interface: org.mmbase.util.logging.Logger
See Also:
Logger.debug(java.lang.Object)

debug

public void debug(java.lang.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

service

public void service(java.lang.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

info

public void info(java.lang.Object m)
Description copied from interface: Logger
Logs the message m with info priority. As `service', but focussed on things system administrators are ussually most interesed 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

warn

public void warn(java.lang.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

error

public void error(java.lang.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

fatal

public void fatal(java.lang.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

isDebugEnabled

public 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 boolean isServiceEnabled()
Description copied from interface: Logger
Returns true if for this category (Logger), a call to service (debug or trace) would do something.
Specified by:
isServiceEnabled in interface Logger


MMBase 2001