The MDC will only return a hash table if a key has been placed in the MDC.
If no keys have been placed in the MDC, then there is no hash table.  You
can look at the MDC code to verify this.

-Mark

> -----Original Message-----
> From: Sundararaman, Anand [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 31, 2002 2:31 AM
> To: Log4J Users List
> Subject: Problem in MDC
> 
> 
> 
> Hi,
>     I have a problem which needs urgent attention. I am using
> MDC.getContext() which is supposed to return a Hashtable , 
> but returns me a
> null. I am not able to find how this object is to be used.  
> If someone can
> give me a example program using MDC it will be very useful.
> 
> The method i am using is as follows
> 
> public static LogEntryObject getFromThread(){
>               Hashtable mdc = MDC.getContext();
>               LogEntryObject logEntry =
> (LogEntryObject)mdc.get("LogEntry");
>               if(logEntry == null){
>                       logEntry = new LogEntryObject(mdc);
>                       mdc.put("LogEntry", logEntry);
>               }
>               return logEntry;
> 
>       }
> 
> Thanks in advance.
> Anand
> WARNING: The information in this message is confidential and 
> may be legally
> privileged. It is intended solely for the addressee.  Access 
> to this message
> by anyone else is unauthorised.  If you are not the intended 
> recipient, any
> disclosure, copying, or distribution of the message, or any action or
> omission taken by you in reliance on it, is prohibited and 
> may be unlawful.
> Please immediately contact the sender if you have received 
> this message in
> error. Thank you.
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to