You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Mathias Bogaert <pa...@pandora.be> on 2001/05/20 13:33:32 UTC
ndc.peek()
Requested:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1801
"It is useful to know what is on the Thread local stack without having to
remove
it from the stack."
Implementation:
/**
Looks at the diagnosticcontext at the top of this NDC without removing
it.
<p>The returned value is the value that was pushed last. If no
context is available, then the empty string "" is returned.
@return String The innermost diagnostic context.
*/
public
static
String peek() {
Thread key = Thread.currentThread();
Stack stack = (Stack) ht.get(key);
if(stack != null && !stack.isEmpty())
return ((DiagnosticContext) stack.peek()).message;
else
return "";
}
+1
Mathias
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org