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 Lutz Michael <mi...@siemens.com> on 2004/09/15 15:21:16 UTC

MDC in J2EE


According to the J2EE spec there is no guarantee that a .forward request or
an EJB call will execute on the same thread (even if the EJB call lands in
the same process).  This seems to render MDC and NDC much less useful
because these constructs rely on the thread.  Changing it pulls the rug out
from under the mechanism.

Am I missing something?  Is there a "standard" way Log4j users should handle
MDC to ensure the context persists across .forward and EJB calls (when in
the same process)?

I reviewed the Complete Manual and couldn't find anything related to this
question.

Thanks for your time.

Mike

_______________________________________________
Siemens Medical Solutions Health Services 
Michael Lutz
Software Engineer, Soarian Common Components
51 Valley Stream Parkway, Malvern, PA 19355 
Office / Voice Mail	+01 610-219-8613 
Cell			+01 610-952-2289
Home Office		+01 610-989-3623
Fax			+01 610-219-4004 
E-mail <ma...@siemens.com> 
_______________________________________________


-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to Central.SecurityOffice@shs.siemens.com 

Thank you

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


Re: MDC in J2EE

Posted by Ceki Gülcü <ce...@qos.ch>.
Michael,

Will the new thread be child of the invoking thread? If so, you can modify 
MDC to use InheritableThreadLocal
instead of ThreadLocal (just a one liner change).

Let us know if it works.

At 03:21 PM 9/15/2004, you wrote:


>According to the J2EE spec there is no guarantee that a .forward request or
>an EJB call will execute on the same thread (even if the EJB call lands in
>the same process).  This seems to render MDC and NDC much less useful
>because these constructs rely on the thread.  Changing it pulls the rug out
>from under the mechanism.
>
>Am I missing something?  Is there a "standard" way Log4j users should handle
>MDC to ensure the context persists across .forward and EJB calls (when in
>the same process)?
>
>I reviewed the Complete Manual and couldn't find anything related to this
>question.
>
>Thanks for your time.
>
>Mike
>
>_______________________________________________
>Siemens Medical Solutions Health Services
>Michael Lutz
>Software Engineer, Soarian Common Components
>51 Valley Stream Parkway, Malvern, PA 19355
>Office / Voice Mail     +01 610-219-8613
>Cell                    +01 610-952-2289
>Home Office             +01 610-989-3623
>Fax                     +01 610-219-4004
>E-mail <ma...@siemens.com>
>_______________________________________________
>
>
>-------------------------------------------------------------------------------
>This message and any included attachments are from Siemens Medical Solutions
>USA, Inc. and are intended only for the addressee(s).
>The information contained herein may include trade secrets or privileged or
>otherwise confidential information.  Unauthorized review, forwarding, 
>printing,
>copying, distributing, or using such information is strictly prohibited 
>and may
>be unlawful.  If you received this message in error, or have reason to 
>believe
>you are not authorized to receive it, please promptly delete this message and
>notify the sender by e-mail with a copy to 
>Central.SecurityOffice@shs.siemens.com
>
>Thank you
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



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