Sonic ESB API

com.sonicsw.esb.service.common.util
Class MDCFilter

java.lang.Object
  extended by org.apache.log4j.spi.Filter
      extended by com.sonicsw.esb.service.common.util.MDCFilter
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

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

Log filter that denies log events unless a specified name/value pair is set in the mapped diagnostic context for the current thread.

There are two modes of operation:

Filters can be configured using an XML log4j configuration file. For example, the following configuration filters out any log messages not produced by MyServiceInstance:

 <appender name="xqLog" class="org.apache.log4j.ConsoleAppender">
   <layout> ... </layout>
   <filter class="com.sonicsw.esb.service.common.util.MDCFilter">
     <param name="key" value="service"/>
     <param name="value" value="MyServiceInstance"/>
   </filter>
 </appender>
 

See Also:
MDC

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 event)
           
 java.lang.String getKey()
           
 java.lang.String getValue()
           
 boolean isInvert()
           
 boolean isRequired()
           
 void setInvert(boolean invert)
           
 void setKey(java.lang.String key)
           
 void setRequired(boolean required)
           
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDCFilter

public MDCFilter()
Method Detail

decide

public int decide(org.apache.log4j.spi.LoggingEvent event)
Specified by:
decide in class org.apache.log4j.spi.Filter

getKey

public java.lang.String getKey()

setKey

public void setKey(java.lang.String key)

getValue

public java.lang.String getValue()

setValue

public void setValue(java.lang.String value)

isRequired

public boolean isRequired()

setRequired

public void setRequired(boolean required)

isInvert

public boolean isInvert()

setInvert

public void setInvert(boolean invert)

Sonic ESB API

Copyright © 2001-2013 Aurea, Inc. All Rights Reserved.
HTML formatted on 29-April-2013.