Log4j 1.3alpha-6

org.apache.log4j.spi
Class LoggingEventFieldResolver

java.lang.Object
  |
  +--org.apache.log4j.spi.LoggingEventFieldResolver

public final class LoggingEventFieldResolver
extends java.lang.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

Field Summary
static java.lang.String CLASS_FIELD
           
static java.lang.String EMPTY_STRING
           
static java.lang.String EXCEPTION_FIELD
           
static java.lang.String FILE_FIELD
           
static java.util.List keywordList
           
static java.lang.String LEVEL_FIELD
           
static java.lang.String LINE_FIELD
           
static java.lang.String LOGGER_FIELD
           
static java.lang.String METHOD_FIELD
           
static java.lang.String MSG_FIELD
           
static java.lang.String NDC_FIELD
           
static java.lang.String PROP_FIELD
           
static java.lang.String THREAD_FIELD
           
static java.lang.String TIMESTAMP_FIELD
           
 
Method Summary
 java.lang.String applyFields(java.lang.String replaceText, LoggingEvent event)
           
static LoggingEventFieldResolver getInstance()
           
 java.lang.Object getValue(java.lang.String fieldName, LoggingEvent event)
           
 boolean isField(java.lang.String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keywordList

public static final java.util.List keywordList

LOGGER_FIELD

public static final java.lang.String LOGGER_FIELD
See Also:
Constant Field Values

LEVEL_FIELD

public static final java.lang.String LEVEL_FIELD
See Also:
Constant Field Values

CLASS_FIELD

public static final java.lang.String CLASS_FIELD
See Also:
Constant Field Values

FILE_FIELD

public static final java.lang.String FILE_FIELD
See Also:
Constant Field Values

LINE_FIELD

public static final java.lang.String LINE_FIELD
See Also:
Constant Field Values

METHOD_FIELD

public static final java.lang.String METHOD_FIELD
See Also:
Constant Field Values

MSG_FIELD

public static final java.lang.String MSG_FIELD
See Also:
Constant Field Values

NDC_FIELD

public static final java.lang.String NDC_FIELD
See Also:
Constant Field Values

EXCEPTION_FIELD

public static final java.lang.String EXCEPTION_FIELD
See Also:
Constant Field Values

TIMESTAMP_FIELD

public static final java.lang.String TIMESTAMP_FIELD
See Also:
Constant Field Values

THREAD_FIELD

public static final java.lang.String THREAD_FIELD
See Also:
Constant Field Values

PROP_FIELD

public static final java.lang.String PROP_FIELD
See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values
Method Detail

applyFields

public java.lang.String applyFields(java.lang.String replaceText,
                                    LoggingEvent event)

getInstance

public static LoggingEventFieldResolver getInstance()

isField

public boolean isField(java.lang.String fieldName)

getValue

public java.lang.Object getValue(java.lang.String fieldName,
                                 LoggingEvent event)

Log4j 1.3alpha-6

Copyright 2000-2005 Apache Software Foundation.