| org.apache.mina.filter.util.CommonEventFilter org.apache.mina.filter.logging.MdcInjectionFilter
MdcInjectionFilter | public class MdcInjectionFilter extends CommonEventFilter (Code) | | This filter will inject some key IoSession properties into the Mapped Diagnostic Context (MDC)
These properties will be set in the MDC for all logging events that are generated
down the call stack, even in code that is not aware of MINA.
By default, the following properties will be set for all transports:
- "handlerClass"
- "remoteAddress"
- "localAddress"
When session.getTransportMetadata().getAddressType() == InetSocketAddress.class
the following properties will also be set:
- "remoteIp"
- "remotePort"
- "localIp"
- "localPort"
User code can also add properties to the context, via
If you only want the MDC to be set for the IoHandler code, it's enough to add
one MdcInjectionFilter at the end of the filter chain.
If you want the MDC to be set for ALL code, you should
add an MdcInjectionFilter to the start of the chain
and add one after EVERY ExecutorFilter in the chain
author: The Apache MINA Project (dev@mina.apache.org) version: $Rev: 566952 $, $Date: 2007-08-17 09:25:04 +0200 (vr, 17 aug 2007) $ |
Inner Class :public enum MdcKey | |
MdcInjectionFilter | public MdcInjectionFilter()(Code) | | |
fillContext | protected void fillContext(IoSession session, Map<String, String> context)(Code) | | write key properties of the session to the Mapped Diagnostic Context
sub-classes could override this method to map more/other attributes
Parameters: session - the session to map Parameters: context - key properties will be added to this map |
setProperty | public static void setProperty(IoSession session, String key, String value)(Code) | | Add a property to the context for the given session
This property will be added to the MDC for all subsequent events
Parameters: session - The session for which you want to set a property Parameters: key - The name of the property (should not be null) Parameters: value - The value of the property |
Methods inherited from org.apache.mina.filter.util.CommonEventFilter | final public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) throws Exception(Code)(Java Doc) abstract protected void filter(IoFilterEvent event) throws Exception(Code)(Java Doc) final public void filterClose(NextFilter nextFilter, IoSession session) throws Exception(Code)(Java Doc) final public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception(Code)(Java Doc) final public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception(Code)(Java Doc) final public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception(Code)(Java Doc) final public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception(Code)(Java Doc) final public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception(Code)(Java Doc) final public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception(Code)(Java Doc) final public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception(Code)(Java Doc)
|
|
|