Author: sdeboy
Date: Sun Oct 25 07:42:21 2009
New Revision: 829505
URL: http://svn.apache.org/viewvc?rev=829505&view=rev
Log:
Add new 'marker' feature
Marker is displayed as an icon that appears in the first displayed column
(using 'about' icon currently)
Ctrl-F2 or double-click: toggle a marker on or off
F2: search for next marker
Shift-F2: search for previous marker
Ctrl-Shift-F2: clear all markers
To facilitate search, rendering & toggle of markers, adding a marker
temporarily adds a new property to events that have the marker set called
'log4j.marker' (value 'true')'.
Also added a new method to LoggingEvent:
public Object removeProperty(String propName)
to facilitate removal of this temporary property when the marker is un-set for
a loggingevent
Modified:
logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
Modified:
logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
URL:
http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java?rev=829505&r1=829504&r2=829505&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
(original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java
Sun Oct 25 07:42:21 2009
@@ -17,17 +17,9 @@
package org.apache.log4j.spi;
-import org.apache.log4j.Category;
-import org.apache.log4j.Level;
-import org.apache.log4j.MDC;
-import org.apache.log4j.NDC;
-import org.apache.log4j.Priority;
-import org.apache.log4j.helpers.Loader;
-import org.apache.log4j.helpers.LogLog;
-
+import java.io.InterruptedIOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.InterruptedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
@@ -36,6 +28,14 @@
import java.util.Map;
import java.util.Set;
+import org.apache.log4j.Category;
+import org.apache.log4j.Level;
+import org.apache.log4j.MDC;
+import org.apache.log4j.NDC;
+import org.apache.log4j.Priority;
+import org.apache.log4j.helpers.Loader;
+import org.apache.log4j.helpers.LogLog;
+
// Contributors: Nelson Minar <[email protected]>
// Wolf Siberski
// Anders Kristensen <[email protected]>
@@ -619,5 +619,21 @@
}
-
+ /**
+ * This removes the specified MDC property from the event.
+ * Access to the MDC is not synchronized, so this
+ * method should only be called when it is known that
+ * no other threads are accessing the MDC.
+ * @param propName the property name to remove
+ * @since 1.2.16
+ */
+ public Object removeProperty(String propName) {
+ if (mdcCopy == null) {
+ getMDCCopy();
+ }
+ if (mdcCopy == null) {
+ mdcCopy = new Hashtable();
+ }
+ return mdcCopy.remove(propName);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]