public class AlluxioRemoteLogFilter
extends org.apache.log4j.spi.Filter
LoggingEvent
. Remote log server can read
LoggingEvent
off Socket
and retrieve the
MDC information. In this case the MDC information is the name of the log4j appender.
Remote log server then uses this appender to log messages. The implementation of this
class is similar to that of org.apache.log4j.varia.StringMatchFilter
.Modifier and Type | Field and Description |
---|---|
static String |
PROCESS_TYPE_OPTION
Deprecated.
Option name to configure this
AlluxioRemoteLogFilter
in log4j.properties. |
static String |
REMOTE_LOG_MDC_PROCESS_TYPE_KEY
Name (Key) of the MDC info.
|
Constructor and Description |
---|
AlluxioRemoteLogFilter() |
Modifier and Type | Method and Description |
---|---|
int |
decide(org.apache.log4j.spi.LoggingEvent event) |
String[] |
getOptionStrings()
Deprecated.
Gets the option strings.
|
String |
getProcessType()
Retrieves the string representation of process type.
|
void |
setOption(String key,
String value)
Deprecated.
Sets option value use key=value format. The log4j.properties file uses this
to set options. See the log4j.properties for more details.
|
void |
setProcessType(String processType)
Sets
mProcessType to be the type of the process generating this log message. |
public static final String REMOTE_LOG_MDC_PROCESS_TYPE_KEY
@Deprecated public static final String PROCESS_TYPE_OPTION
AlluxioRemoteLogFilter
in log4j.properties.@Deprecated public String[] getOptionStrings()
@Deprecated public void setOption(String key, String value)
key
- key (name) of the optionvalue
- value of the optionpublic void setProcessType(String processType)
mProcessType
to be the type of the process generating this log message.
Log4j parses log4j.properties, extracting the Java class that corresponds to the filter.
In this case, the Java class is AlluxioRemoteLogFilter
.
Log4j also extracts option information as a key-value pair, e.g.
"ProcessType" : "MASTER". Then log4j invokes the setProcessType(String)
method to set the value of mProcessType
.processType
- name of the log appenderpublic String getProcessType()
org.apache.log4j.varia.StringMatchFilter
, we should prevent
this method from been removed.public int decide(org.apache.log4j.spi.LoggingEvent event)
decide
in class org.apache.log4j.spi.Filter
Copyright © 2023. All Rights Reserved.