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 jay andrews <ja...@hotmail.com> on 2004/01/27 16:11:01 UTC

Understanding MDC

Hello,
I am just beginning to use log4j and I am trying to get my head around using 
the MDC class.  From reading through the archives it appears that I need to 
use this class for my logging within my servlet.  That being said, I'm 
having a little understanding exactly how its used.  Is it as simple as the 
following or is there more to it?  Can someone please shed some light?

Thanks.


MyServlet extends HttpServlet {

  public void doPost {

    MDC.put("ipAddress", ipAddress);
    logger.info("my event.");

    // code

    logger.info("my event2.");

  }

}

_________________________________________________________________
Learn how to choose, serve, and enjoy wine at Wine @ MSN. 
http://wine.msn.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org