public class TLcdJULSimpleFormatter extends Formatter
LogRecord
messages. The following properties of a
LogRecord
are used as the argument list to the
String.format(String, Object...)
method:
LogRecord.getMessage()
LogRecord.getLoggerName()
LogRecord.getLevel()
LogRecord.getMillis()
as a Date objectLogRecord.getSourceClassName()
LogRecord.getSourceMethodName()
LogRecord.getThreadID()
LogRecord.getThrown()
com.luciad.util.logging.TLcdJULSimpleFormatter.format
in the
Java logging properties file.
When the LogRecord contains a Throwable object the corresponding stack trace
is also logged immediately after the message. To disable logging of the stack
trace you can set the property
com.luciad.util.logging.TLcdJULSimpleFormatter.logStackTrace
to false
For example, the following two configuration lines:
java.util.logging.ConsoleHandler.formatter = com.luciad.util.logging.TLcdJULSimpleFormatter
com.luciad.util.logging.TLcdJULSimpleFormatter.format = %3$s: %1$s (%8$s)\n
com.luciad.util.logging.TLcdJULSimpleFormatter.logStackTrace = false
may display a log message as
"SEVERE: An exception occurred (ArrayIndexOutOfBoundsException)"
.
It will not display the stack trace.LogManager
,
LogRecord
,
Formatter
,
String.format(String, Object...)
Constructor and Description |
---|
TLcdJULSimpleFormatter()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
format(LogRecord aRecord) |
String |
getFormat()
Returns the log format string.
|
boolean |
isLogStackTrace()
Returns true if the stack of Throwable objects is logged, false otherwise.
|
void |
setFormat(String aFormat)
Sets the log format string
|
void |
setLogStackTrace(boolean aLogStackTrace)
Sets the value of the logStackTrace property.
|
formatMessage, getHead, getTail
public String getFormat()
public void setFormat(String aFormat)
aFormat
- the format stringpublic boolean isLogStackTrace()
public void setLogStackTrace(boolean aLogStackTrace)
aLogStackTrace
- if true (default), stack traces are logged.