org.dcm4che.log
Class MDCFilter

java.lang.Object
  extended by org.apache.log4j.spi.Filter
      extended by org.dcm4che.log.MDCFilter
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

public class MDCFilter
extends org.apache.log4j.spi.Filter

Author:
franz.willer A log4j filter to filter messages according to MDC values.

Field Summary
 
Fields inherited from class org.apache.log4j.spi.Filter
ACCEPT, DENY, NEUTRAL, next
 
Constructor Summary
MDCFilter()
           
 
Method Summary
 int decide(org.apache.log4j.spi.LoggingEvent e)
          Checks if the value of MDC with key match with value.
 java.lang.String getKey()
          Returns the key value that is used to get value from MDC.
 java.lang.String getValue()
          Returns the matching value.
 boolean isAcceptOnMatch()
          Determines if decide returns ACCEPT or DENY if matching.
 void setAcceptOnMatch(boolean acceptOnMatch)
           
 void setKey(java.lang.String key)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class org.apache.log4j.spi.Filter
activateOptions, getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDCFilter

public MDCFilter()
Method Detail

decide

public int decide(org.apache.log4j.spi.LoggingEvent e)
Checks if the value of MDC with key match with value. Returns NEUTRAL if the check fails. Otherwise return ACCEPT if acceptOnMatch is true or DENY if false.

Specified by:
decide in class org.apache.log4j.spi.Filter
See Also:
Filter.decide(org.apache.log4j.spi.LoggingEvent)

isAcceptOnMatch

public boolean isAcceptOnMatch()
Determines if decide returns ACCEPT or DENY if matching.

Returns:
Returns the acceptOnMatch.

setAcceptOnMatch

public void setAcceptOnMatch(boolean acceptOnMatch)
Parameters:
acceptOnMatch - The acceptOnMatch to set.

getKey

public java.lang.String getKey()
Returns the key value that is used to get value from MDC.

Returns:
Returns the key.

setKey

public void setKey(java.lang.String key)
Parameters:
key - The key to set.

getValue

public java.lang.String getValue()
Returns the matching value.

Returns:
Returns the value.

setValue

public void setValue(java.lang.String value)
Parameters:
value - The value to set.