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 "Sundararaman, Anand" <An...@blr.hpsglobal.com> on 2002/07/31 11:31:08 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>