org.vfny.geoserver.global
Class Log4JFormatter
java.lang.Object
java.util.logging.Formatter
org.vfny.geoserver.global.Log4JFormatter
- public class Log4JFormatter
- extends java.util.logging.Formatter
Log4JFormatter
looks like:
[core FINE] A log message logged with level FINE from the "org.geotools.core"
logger.
A formatter writting log message on a single line. This formatter is used by
GeoServer instead of SimpleFormatter
. The main difference is that
this formatter use only one line per message instead of two. For example, a
message formatted by
Constructor Summary |
Log4JFormatter(java.lang.String base)
Construct a Log4JFormatter . |
Method Summary |
java.lang.String |
format(java.util.logging.LogRecord record)
Format the given log record and return the formatted string. |
static void |
init(java.lang.String base,
java.util.logging.Level filterLevel)
Setup a Log4JFormatter for the specified logger and its
children. |
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 |
Log4JFormatter
public Log4JFormatter(java.lang.String base)
- Construct a
Log4JFormatter
.
- Parameters:
base
- The base logger name. This is used for shortening the logger
name when formatting message. For example, if the base logger
name is "org.geotools" and a log record come from the
"org.geotools.core" logger, it will be formatted as "[LEVEL
core]" (i.e. the "org.geotools" part is ommited).
format
public java.lang.String format(java.util.logging.LogRecord record)
- Format the given log record and return the formatted string.
- Parameters:
record
- the log record to be formatted.
- Returns:
- a formatted log record
- Throws:
java.lang.AssertionError
- Should never occur.
init
public static void init(java.lang.String base,
java.util.logging.Level filterLevel)
- Setup a
Log4JFormatter
for the specified logger and its
children. This method search for all instances of ConsoleHandler
using the SimpleFormatter
. If such instances
are found, they are replaced by a single instance of
Log4JFormatter
writting to the (instead of the ). This action has no effect on any loggers
outside the base
namespace.
- Parameters:
base
- The base logger name to apply the change on (e.g.
"org.geotools").filterLevel
- The level to log at - overrides user prefs.