org.mmbase.util.logging
Interface Logger

All Known Implementing Classes:
AbstractSimpleImpl, AnalyzerLogger, BufferedLogger, ChainedLogger, CommonsLog, ErrorDetector, ExceptionImpl, Impl, Log4jImpl, LoggerWrapper, SimpleImpl, SimpleTimeStampImpl, WriterLogger

public interface Logger

The `Logger' interface for MMBase. It was designed for use with Log4j, but it is of course easy to implement it differently as well.

Implementations should also supply a getLoggerInstance static method, and can supply a configure static method.

For example:
 
 import org.mmbase.util.logging.Logging;
 import org.mmbase.util.logging.Logger;

 public class Foo {
     static Logger log = Logging.getLoggerInstance(Foo.class.getName());
     public void bar() {
         ...
         log.info("Hello world!");
         ...
         if(log.isDebugEnabled()) {
             log.debug("Oops, that's not quite right!");
         }
         ...
     }
 }
 
 

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

Method Detail

trace

void trace(Object m)
Logs the message m with trace priority. For detailled debugging.

See Also:
debug(Object)

trace

void trace(Object m,
           Throwable t)
Since:
MMBase-1.8

debug

void debug(Object m)
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.


debug

void debug(Object m,
           Throwable t)
Since:
MMBase-1.8

service

void service(Object m)
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.


service

void service(Object m,
             Throwable t)
Since:
MMBase-1.8

info

void info(Object m)
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.


info

void info(Object m,
          Throwable t)
Since:
MMBase-1.8

warn

void warn(Object m)
Logs the message m with warn priority. Something strange happened, but it is not necessarily an error.


warn

void warn(Object m,
          Throwable t)
Since:
MMBase-1.8

error

void error(Object m)
Logs the message m with error priority. Something is definitely wrong. An inconsistency was detected. It might be unpredictable what will happen.


error

void error(Object m,
           Throwable t)
Since:
MMBase-1.8

fatal

void fatal(Object m)
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.


fatal

void fatal(Object m,
           Throwable t)
Since:
MMBase-1.8

isTraceEnabled

boolean isTraceEnabled()
Returns true if for this category (Logger), a call to trace would do something.


isDebugEnabled

boolean isDebugEnabled()
Returns true if for this category (Logger), a call to debug (or trace) would do something.


isServiceEnabled

boolean isServiceEnabled()
Returns true if for this category (Logger), a call to service (or debug or trace) would do something.


setLevel

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. This could be usefull for example to switch on all debug logging when something has gone wrong.

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.

isEnabledFor

boolean isEnabledFor(Level l)
Since:
MMBase-1.9.2


MMBase 2.0-SNAPSHOT - null