|
JavaGantt 2011.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.logging.Formatter
eu.beesoft.gaia.log.java.ConfigurableFormatter
public class ConfigurableFormatter
Supports formatting for Java logging system. This formatter can be configured
via method setFormat(String)
. Configuration string describes how to
format log data. Here are supported commands:
You can combine more of them in the configuration string. Each command must start with % character, then follows (optional) width in characters with possible '-' (minus) sign before it to force rigth-side alignment, and ends with command letter. Here is as an example the default configuration string:
%D.%M.%Y %h:%m:%s.%u [%5L] %T %-45C | %G
Note the P command: it formats a first parameter from
java.util.logging.LogRecord
obtained with its method
getParameters(). The JavaLog
uses this parameter to store a thread
bound identifier, if it was set via
LogFactory.setThreadBoundIdentifier(String)
method. This command is
useful in a server environment, it is more understandable to write lo log for
example a client / user name, than just simple thread name.
Constructor Summary | |
---|---|
ConfigurableFormatter()
Creates a new instance of configurable formatter. |
Method Summary | |
---|---|
java.lang.String |
format(java.util.logging.LogRecord record)
Overrides parent's format() method to apply this instance formatting |
java.lang.String |
getFormat()
Returns currently used format. |
void |
setFormat(java.lang.String format)
Sets a new format. |
Methods inherited from class java.util.logging.Formatter |
---|
formatMessage, getHead, getTail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigurableFormatter()
%D.%M.%Y %h:%m:%s.%u [%5L] %T %-45C | %G
Method Detail |
---|
public java.lang.String getFormat()
public void setFormat(java.lang.String format)
public java.lang.String format(java.util.logging.LogRecord record)
format
in class java.util.logging.Formatter
record
- - source data for formatting
|
JavaGantt 2011.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |