| org.mmbase.util.logging.Logger
All known Subclasses: org.mmbase.util.logging.AbstractSimpleImpl, org.mmbase.util.logging.SimpleImpl, org.mmbase.util.logging.LoggerWrapper, org.mmbase.util.logging.ExceptionImpl, org.mmbase.util.logging.SimpleTimeStampImpl, org.mmbase.util.logging.log4j.Log4jImpl, org.mmbase.util.logging.java.Impl,
Logger | public interface Logger (Code) | | 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) | public boolean | isDebugEnabled() Returns true if for this category (Logger), a call to debug (or
trace) would do something. | public boolean | isServiceEnabled() Returns true if for this category (Logger), a call to service
(or debug or trace) would do something. | public 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) | public 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) |
debug | void debug(Object m)(Code) | | 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.
|
error | void error(Object m)(Code) | | Logs the message m with error priority. Something is definitely
wrong. An inconsistency was detected. It might be unpredictable
what will happen.
|
fatal | void fatal(Object m)(Code) | | 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.
|
info | void info(Object m)(Code) | | 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.
|
isDebugEnabled | public boolean isDebugEnabled()(Code) | | Returns true if for this category (Logger), a call to debug (or
trace) would do something.
|
isServiceEnabled | public boolean isServiceEnabled()(Code) | | Returns true if for this category (Logger), a call to service
(or debug or trace) would do something.
|
isTraceEnabled | public boolean isTraceEnabled()(Code) | | Returns true if for this category (Logger), a call to trace
would do something.
|
service | void service(Object m)(Code) | | 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.
|
setLevel | public void setLevel(Level p)(Code) | | 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 constantsLevel.TRACE, Level.DEBUG, Level.SERVICE, Level.INFO,Level.WARN, Level.ERROR or Level.FATAL. |
warn | void warn(Object m)(Code) | | Logs the message m with warn priority. Something strange
happened, but it is not necessarily an error.
|
|
|