|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.spi.LoggingEventFieldResolver
public final class LoggingEventFieldResolver
A singleton helper utility which accepts a field name and a LoggingEvent and returns the 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.
Field Summary | |
---|---|
static java.lang.String |
CLASS_FIELD
CLASS string literal. |
static java.lang.String |
EMPTY_STRING
empty string literal. |
static java.lang.String |
EXCEPTION_FIELD
EXCEPTION string literal. |
static java.lang.String |
FILE_FIELD
FILE string literal. |
static java.util.List |
KEYWORD_LIST
Keyword list. |
static java.lang.String |
LEVEL_FIELD
LEVEL string literal. |
static java.lang.String |
LINE_FIELD
LINE string literal. |
static java.lang.String |
LOGGER_FIELD
LOGGER string literal. |
static java.lang.String |
METHOD_FIELD
METHOD string literal. |
static java.lang.String |
MSG_FIELD
MSG string literal. |
static java.lang.String |
NDC_FIELD
NDC string literal. |
static java.lang.String |
PROP_FIELD
PROP. |
static java.lang.String |
THREAD_FIELD
THREAD string literal. |
static java.lang.String |
TIMESTAMP_FIELD
TIMESTAMP string literal. |
Method Summary | |
---|---|
java.lang.String |
applyFields(java.lang.String replaceText,
org.apache.log4j.spi.LoggingEvent event)
Apply fields. |
static LoggingEventFieldResolver |
getInstance()
Get singleton instance. |
java.lang.Object |
getValue(java.lang.String fieldName,
org.apache.log4j.spi.LoggingEvent event)
Get value of field. |
boolean |
isField(java.lang.String fieldName)
Determines if specified string is a recognized field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.List KEYWORD_LIST
public static final java.lang.String LOGGER_FIELD
public static final java.lang.String LEVEL_FIELD
public static final java.lang.String CLASS_FIELD
public static final java.lang.String FILE_FIELD
public static final java.lang.String LINE_FIELD
public static final java.lang.String METHOD_FIELD
public static final java.lang.String MSG_FIELD
public static final java.lang.String NDC_FIELD
public static final java.lang.String EXCEPTION_FIELD
public static final java.lang.String TIMESTAMP_FIELD
public static final java.lang.String THREAD_FIELD
public static final java.lang.String PROP_FIELD
public static final java.lang.String EMPTY_STRING
Method Detail |
---|
public java.lang.String applyFields(java.lang.String replaceText, org.apache.log4j.spi.LoggingEvent event)
replaceText
- replacement text.event
- logging event.
public static LoggingEventFieldResolver getInstance()
public boolean isField(java.lang.String fieldName)
fieldName
- field name
public java.lang.Object getValue(java.lang.String fieldName, org.apache.log4j.spi.LoggingEvent event)
fieldName
- fieldevent
- event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010 The Apache Software Foundation. Licensed under the Apache License, Version 2.0
Apache Extras Companion for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.