See: Description
| Class | Description |
|---|---|
| Formatter |
Abstract class that formats LogRecords
|
| Handler |
A Handler exports LogRecords to some destination.
|
| Level |
A level measures the importance of a entry in a log file.
|
| Logger |
A logger is used to record messages and events.
|
| LogRecord |
A
LogRecord encapsulate an entry in a log. |
| SimpleFormatter |
A Formatter that returns a textual description of a LogRecord
|
| StreamHandler |
A
StreamHandler exports log records to an
OutputStream. |
This package contains classes that implement a logging mechanism similar to the one in JDK 1.4. While the basic mechanism is present, many of the more advanced features (such as writing logs as XML and performing filtering) are not implemented.
Logger logger = Logger.getLogger("com.gemstone.persistence.jdo");
...
// Send logging output to a file, by default it will go to System.err
Handler handler = new StreamHandler(new FileOutputStream(file),
new SimpleFormatter());
logger.addHandler(handler);
...
logger.warning("Could not find file: " + fileName);
...
// Ignore all messages that are lower than Level.INFO
logger.setLevel(Level.INFO);
...
logger.throwing("com.gemstone.persistence.jdo.StateManagerImpl",
"readFile", ex);
..
logger.info("Found these objects: ", objs);
A Logger's level may also be specified at runtime using a system propery. To set the level of the logger name "com.gemstone.persistence.jdo.Logger" to FINE use
-Dcom.gemstone.persistence.jdo.Logger.LEVEL=FINE
If the com.gemstone.persistence.logging.StackTraces
system property is set to true, then a stack trace will
be printed along with every message.
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.