org.apache.log4j.spi
Class LoggingEventFieldResolver
java.lang.Object
|
+--org.apache.log4j.spi.LoggingEventFieldResolver
- public final class LoggingEventFieldResolver
- extends Object
A singleton helper utility which accepts a field name and a LoggingEvent and returns the
String value of that field.
This class defines a grammar used in creation of an expression-based Rule.
The only available method is Object getField(String fieldName, LoggingEvent event).
Here is a description of the mapping of field names in the grammar
to fields on the logging event. While the getField method returns an Object, the
individual types returned per field are described here:
Field Name Field value (String representation Return type
LOGGER category name (logger) String
LEVEL level Level
CLASS locationInformation's class name String
FILE locationInformation's file name String
LINE locationInformation's line number String
METHOD locationInformation's method name String
MSG message Object
NDC NDC String
EXCEPTION throwable string representation ThrowableInformation
TIMESTAMP timestamp Long
THREAD thread String
PROP.keyName entry in the Property hashtable String
mapped to the key [keyName]
NOTE: the values for the 'keyName' portion of the MDC and PROP mappings must
be an exact match to the key in the hashTable (case sensitive).
If the passed-in field is null or doesn't match an entry in the above-described
mapping, an exception is thrown.
- Author:
- Scott Deboy , Paul Smith
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
keywordList
public static final List keywordList
LOGGER_FIELD
public static final String LOGGER_FIELD
LEVEL_FIELD
public static final String LEVEL_FIELD
CLASS_FIELD
public static final String CLASS_FIELD
FILE_FIELD
public static final String FILE_FIELD
LINE_FIELD
public static final String LINE_FIELD
METHOD_FIELD
public static final String METHOD_FIELD
MSG_FIELD
public static final String MSG_FIELD
NDC_FIELD
public static final String NDC_FIELD
EXCEPTION_FIELD
public static final String EXCEPTION_FIELD
TIMESTAMP_FIELD
public static final String TIMESTAMP_FIELD
THREAD_FIELD
public static final String THREAD_FIELD
PROP_FIELD
public static final String PROP_FIELD
EMPTY_STRING
public static final String EMPTY_STRING
applyFields
public String applyFields(String replaceText,
LoggingEvent event)
getInstance
public static LoggingEventFieldResolver getInstance()
isField
public boolean isField(String fieldName)
getValue
public Object getValue(String fieldName,
LoggingEvent event)
Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.