org.mmbase.util.logging
Class AbstractSimpleImpl

java.lang.Object
  extended by org.mmbase.util.logging.AbstractSimpleImpl
All Implemented Interfaces:
Logger
Direct Known Subclasses:
AnalyzerLogger, BufferedLogger, CommonsLog, ErrorDetector, ExceptionImpl, SimpleImpl, SimpleTimeStampImpl, WriterLogger

public abstract class AbstractSimpleImpl
extends Object
implements Logger

Base class for simple Logger implementations (no patterns and so on).

Since:
MMBase-1.7
Author:
Michiel Meeuwissen

Field Summary
protected  int level
           
 
Constructor Summary
AbstractSimpleImpl()
           
 
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)
           
static MDC getMDC()
           
 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 isEnabledFor(Level l)
           
 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.
protected  void log(Object s, Level level)
          Override to implement different stringification of objects to log.
protected  void log(Object s, Level level, Throwable t)
           
protected  void log(String s)
          How to write one string.
protected  void log(String s, Level level)
          Logs a message for a certain string.
 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
 

Field Detail

level

protected int level
Since:
MMBase-1.8
Constructor Detail

AbstractSimpleImpl

public AbstractSimpleImpl()
Method Detail

getMDC

public static MDC getMDC()
Since:
MMBase-2.0

setLevel

public 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.

log

protected void log(String s)
How to write one string. Only to be called by log(String, Level). Default this does nothing, you must override this, or log(String, Level).


log

protected void log(String s,
                   Level level)
Logs a message for a certain string. Default calls log(String) where the string is prefixed with the level. Override this one if you want it differently.


log

protected void log(Object s,
                   Level level)
Override to implement different stringification of objects to log. (default "" + s)

Since:
MMBase-1.8

log

protected void log(Object s,
                   Level level,
                   Throwable t)
Since:
MMBase-1.8

trace

public 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 void trace(Object m,
                  Throwable t)
Specified by:
trace in interface Logger

debug

public 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 void debug(Object m,
                  Throwable t)
Specified by:
debug in interface Logger

service

public 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 void service(Object m,
                    Throwable t)
Specified by:
service in interface Logger

info

public 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 void info(Object m,
                 Throwable t)
Specified by:
info in interface Logger

warn

public 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 void warn(Object m,
                 Throwable t)
Specified by:
warn in interface Logger

error

public 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 void error(Object m,
                  Throwable t)
Specified by:
error in interface Logger

fatal

public 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 void fatal(Object m,
                  Throwable t)
Specified by:
fatal in interface Logger

isTraceEnabled

public 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 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 (or debug or trace) would do something.

Specified by:
isServiceEnabled in interface Logger

isEnabledFor

public boolean isEnabledFor(Level l)
Specified by:
isEnabledFor in interface Logger


MMBase 2.0-SNAPSHOT - null