|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.util.logging.Logging
With this class the logging is configured and it supplies the `Logger' objects.
For example:
import org.mmbase.util.logging.Logging;
import org.mmbase.util.logging.Logger;
import org.mmbase.util.logging.Level;
public class test {
static {
Logging.configure("log.xml");
}
static Logger log = Logging.getLoggerInstance(test.class.getName());
public static void main(String[] args) {
log.debug("start");
log.info("Entering application.");
log.setPriority(Level.TRACE);
if (log.isDebugEnabled()) {
log.debug("debug een");
log.trace("trace twee");
}
log.info("info");
log.service("service");
Logging.shutdown();
}
}
| Field Summary | |
static java.lang.String |
PAGE_CATEGORY
The category for logging info about pages (like stop / start). |
| Method Summary | |
static void |
configure(java.lang.String configfile)
Configure the logging system. |
static void |
configureClass(java.lang.String configuration)
Calls the 'configure' static method of the used logging class, or does nothing if it doesn't exist. |
static java.io.File |
getConfigurationFile()
Logging is configured with a log file. |
static Logger |
getLoggerInstance(java.lang.Class cl)
Most Logger categories in MMBase are based on class name. |
static Logger |
getLoggerInstance(java.lang.String s)
After configuring the logging system, you can get Logger instances to log with. |
static void |
shutdown()
If the configured Logger implements a shutdown static method, it will be called. |
static java.lang.String |
stackTrace()
Returns the stacktrace of the current call. |
static java.lang.String |
stackTrace(int max)
|
static java.lang.String |
stackTrace(java.lang.Throwable e)
Returns the stacktrace of an exception as a string, which can be logged handy. |
static java.lang.String |
stackTrace(java.lang.Throwable e,
int max)
Also returns a stringified stack trace to log, but no deeper than given max. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String PAGE_CATEGORY
| Method Detail |
public static void configure(java.lang.String configfile)
configfile - Path to an xml-file in which is described
which class must be used for logging, and how this will be
configured (typically the name of another configuration file).public static void configureClass(java.lang.String configuration)
public static java.io.File getConfigurationFile()
public static Logger getLoggerInstance(java.lang.String s)
s - A string describing the `category' of the Logger. This is a log4j concept.public static Logger getLoggerInstance(java.lang.Class cl)
public static void shutdown()
public static java.lang.String stackTrace()
public static java.lang.String stackTrace(int max)
public static java.lang.String stackTrace(java.lang.Throwable e)
e - the Throwable from which the stack trace must be stringified.
public static java.lang.String stackTrace(java.lang.Throwable e,
int max)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||