Methods Summary |
---|
public int | decide(org.apache.log4j.spi.LoggingEvent event)Returns {@link Filter#NEUTRAL} is there is no string match.
String msg = event.getRenderedMessage();
if(msg == null || stringToMatch == null)
return Filter.NEUTRAL;
if( msg.indexOf(stringToMatch) == -1 ) {
return Filter.NEUTRAL;
} else { // we've got a match
if(acceptOnMatch) {
return Filter.ACCEPT;
} else {
return Filter.DENY;
}
}
|
public boolean | getAcceptOnMatch()
return acceptOnMatch;
|
public java.lang.String[] | getOptionStrings()
return new String[] {STRING_TO_MATCH_OPTION, ACCEPT_ON_MATCH_OPTION};
|
public java.lang.String | getStringToMatch()
return stringToMatch;
|
public void | setAcceptOnMatch(boolean acceptOnMatch)
this.acceptOnMatch = acceptOnMatch;
|
public void | setOption(java.lang.String key, java.lang.String value)
if(key.equalsIgnoreCase(STRING_TO_MATCH_OPTION)) {
stringToMatch = value;
} else if (key.equalsIgnoreCase(ACCEPT_ON_MATCH_OPTION)) {
acceptOnMatch = OptionConverter.toBoolean(value, acceptOnMatch);
}
|
public void | setStringToMatch(java.lang.String s)
stringToMatch = s;
|