[prev in list] [next in list] [prev in thread] [next in thread]
List: log4j-cvs
Subject: cvs commit: jakarta-log4j/src/java/org/apache/log4j NDC.java
From: pathos () apache ! org
Date: 2001-05-21 18:24:43
[Download RAW message or body]
pathos 01/05/21 11:24:43
Modified: src/java/org/apache/log4j NDC.java
Log:
Added the ndc.peek() method (similar to stack.peek()).
Revision Changes Path
1.7 +20 -0 jakarta-log4j/src/java/org/apache/log4j/NDC.java
Index: NDC.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/NDC.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NDC.java 2001/05/20 11:20:48 1.6
+++ NDC.java 2001/05/21 18:24:38 1.7
@@ -277,6 +277,26 @@
}
/**
+ Looks at the {@link 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 "";
+ }
+
+ /**
Push new diagnostic context information for the current thread.
<p>The contents of the <code>message</code> parameter is
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-cvs-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic