You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Aquino, Mario" <Ma...@AGEDWARDS.com> on 2002/02/19 15:52:56 UTC
MDC content not showing up in log messages
After scanning the html docs included in the latest beta, I saw that I
should be able to use MDCs in my application code and have their contents
display on log messages (just like NDCs) using the following PatternLayout
configuration:
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-d %-5p [%c] [%M] - %x{sessionId} - %m%n"/>
</layout>
</appender>
Where "sessionId" is a key that I use in my code that load the MDC for an
executing thread at runtime. However, I am seeing the following in my log
messages:
2002-02-19 08:37:02,189 DEBUG [com.foo.bar.filter.WrapperFilter] [doFilter]
- {sessionId} - Exitting method.
My code is doing a simple put (MDC.put("sessionId", "123456789");) but the
data is not showing up in the log messages. What is the problem?
--Mario Aquino
***************************************************************************************
WARNING: All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.
***************************************************************************************