You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/05/18 23:52:44 UTC

svn commit: r1595698 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/ log4j-core/src/main/java/org/apache/logging/log4j/core/async/ log4j-c...

Author: ggregory
Date: Sun May 18 21:52:43 2014
New Revision: 1595698

URL: http://svn.apache.org/r1595698
Log:
org.apache.logging.log4j.core.LogEvent.getContextMap() should never return null. Remove the getContextMap(String) API (aka getContextMapValue(String). The FlumeEvent is a little different and can indeed hold a null context map. All tests pass from Maven.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
    logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java Sun May 18 21:52:43 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.core;
 
+import java.util.Collections;
 import java.util.Map;
 
 import org.apache.logging.log4j.Level;
@@ -31,14 +32,12 @@ public abstract class AbstractLogEvent i
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * Returns {@link Collections#emptyMap()}.
+     */
     @Override
     public Map<String, String> getContextMap() {
-        return null;
-    }
-
-    @Override
-    public String getContextMap(String key) {
-        return null;
+        return Collections.emptyMap();
     }
 
     @Override

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java Sun May 18 21:52:43 2014
@@ -34,21 +34,11 @@ public interface LogEvent extends Serial
     /**
      * Gets the context map (also know as MDC).
      * 
-     * @return A copy of the Mapped Diagnostic Context or null.
+     * @return A copy of the Mapped Diagnostic Context, never {@code null}.
      */
     Map<String, String> getContextMap();
 
     /**
-     * Gets the value at the given key in the context map.
-     * 
-     * @param key the key to query
-     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
-     *         map.
-     */
-    @Deprecated
-    String getContextMap(String key);
-
-    /**
      * Gets the context stack (also known as NDC).
      * 
      * @return A copy of the Nested Diagnostic Context or null;
@@ -130,9 +120,9 @@ public interface LogEvent extends Serial
     ThrowableProxy getThrownProxy();
 
     /**
-     * Returns {@code true} if this event is the last one in a batch, {@code false} otherwise. Used by asynchronous
-     * Loggers and Appenders to signal to buffered downstream components when to flush to disk, as a more efficient
-     * alternative to the {@code immediateFlush=true} configuration.
+     * Returns {@code true} if this event is the last one in a batch, {@code false} otherwise. Used by asynchronous Loggers and Appenders to
+     * signal to buffered downstream components when to flush to disk, as a more efficient alternative to the {@code immediateFlush=true}
+     * configuration.
      * 
      * @return whether this event is the last one in a batch.
      */
@@ -140,9 +130,8 @@ public interface LogEvent extends Serial
     boolean isEndOfBatch();
 
     /**
-     * Returns whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use
-     * this flag to determine whether to take a {@code StackTrace} snapshot or not before handing off this event to
-     * another thread.
+     * Returns whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to
+     * determine whether to take a {@code StackTrace} snapshot or not before handing off this event to another thread.
      * 
      * @return {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
      * @see #getSource()
@@ -151,22 +140,18 @@ public interface LogEvent extends Serial
     boolean isIncludeLocation();
 
     /**
-     * Sets whether this event is the last one in a batch. Used by asynchronous Loggers and Appenders to signal to
-     * buffered downstream components when to flush to disk, as a more efficient alternative to the
-     * {@code immediateFlush=true} configuration.
+     * Sets whether this event is the last one in a batch. Used by asynchronous Loggers and Appenders to signal to buffered downstream
+     * components when to flush to disk, as a more efficient alternative to the {@code immediateFlush=true} configuration.
      * 
-     * @param endOfBatch
-     *            {@code true} if this event is the last one in a batch, {@code false} otherwise.
+     * @param endOfBatch {@code true} if this event is the last one in a batch, {@code false} otherwise.
      */
     void setEndOfBatch(boolean endOfBatch);
 
     /**
-     * Sets whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use
-     * this flag to determine whether to take a {@code StackTrace} snapshot or not before handing off this event to
-     * another thread.
+     * Sets whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to determine
+     * whether to take a {@code StackTrace} snapshot or not before handing off this event to another thread.
      * 
-     * @param locationRequired
-     *            {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
+     * @param locationRequired {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
      * @see #getSource()
      */
     void setIncludeLocation(boolean locationRequired);

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java Sun May 18 21:52:43 2014
@@ -207,18 +207,6 @@ public abstract class BasicLogEventEntit
     }
 
     /**
-     * Gets the value at the given key in the context map.
-     * 
-     * @param key the key to query
-     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
-     *         map.
-     */
-    @Override
-    public String getContextMap(String key) {
-        return this.getWrappedEvent().getContextMap(key);
-    }
-
-    /**
      * Gets the context stack. Annotated with {@code @Convert(converter = ContextStackAttributeConverter.class)}.
      *
      * @return the context stack.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java Sun May 18 21:52:43 2014
@@ -164,15 +164,15 @@ public class RingBufferLogEvent implemen
 	}
 
 	@Override
-	public Throwable getThrown() {
-	    // after deserialization, thrown is null but thrownProxy may be non-null
-	    if (thrown == null) {
-	        if (thrownProxy != null) {
-	            thrown = thrownProxy.getThrowable();
-	        }
-	    }
-  return thrown;
-	}
+    public Throwable getThrown() {
+        // after deserialization, thrown is null but thrownProxy may be non-null
+        if (thrown == null) {
+            if (thrownProxy != null) {
+                thrown = thrownProxy.getThrowable();
+            }
+        }
+        return thrown;
+    }
 
 	@Override
 	public ThrowableProxy getThrownProxy() {
@@ -190,11 +190,6 @@ public class RingBufferLogEvent implemen
 		return contextMap;
 	}
 
-    @Override
-    public String getContextMap(String key) {
-        return contextMap == null ? null : contextMap.get(key);
-    }
-
 	@Override
 	public ContextStack getContextStack() {
 		return contextStack;

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java Sun May 18 21:52:43 2014
@@ -168,7 +168,7 @@ public class Log4jLogEvent implements Lo
         this.level = (level == null) ? Level.OFF : level; // LOG4J2-462, LOG4J2-465
         this.message = message;
         this.thrownProxy = thrownProxy;
-        this.contextMap = contextMap;
+        this.contextMap = contextMap == null ? ThreadContext.EMPTY_MAP : contextMap;
         this.contextStack = contextStack;
         this.timeMillis = message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : timestamp;
         this.threadName = threadName;
@@ -287,7 +287,7 @@ public class Log4jLogEvent implements Lo
      */
     @Override
     public Map<String, String> getContextMap() {
-        return contextMap == null ? ThreadContext.EMPTY_MAP : contextMap;
+        return contextMap;
     }
 
     /**
@@ -300,18 +300,6 @@ public class Log4jLogEvent implements Lo
     }
 
     /**
-     * Gets the value at the given key in the context map.
-     * 
-     * @param key the key to query
-     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
-     *         map.
-     */
-    @Override
-    public String getContextMap(String key) {
-        return contextMap == null ? null : contextMap.get(key);
-    }
-
-    /**
      * Returns the StackTraceElement for the caller. This will be the entry that occurs right
      * before the first occurrence of FQCN as a class name.
      * @return the StackTraceElement for the caller.

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java Sun May 18 21:52:43 2014
@@ -143,11 +143,6 @@ public class TestBaseEntity extends Abst
     }
 
     @Override
-    public String getContextMap(String key) {
-        return this.getWrappedEvent().getContextMap(key);
-    }
-
-    @Override
     @Transient
     public ThreadContext.ContextStack getContextStack() {
         return this.getWrappedEvent().getContextStack();

Modified: logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java (original)
+++ logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java Sun May 18 21:52:43 2014
@@ -295,18 +295,6 @@ public class FlumeEvent extends SimpleEv
     }
 
     /**
-     * Gets the value at the given key in the context map.
-     * 
-     * @param key the key to query
-     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
-     *         map.
-     */
-    @Override
-    public String getContextMap(String key) {
-        return contextMap == null ? null : contextMap.get(key);
-    }
-
-    /**
      * Returns a copy of the context stack.
      * @return a copy of the context stack.
      */



Re: svn commit: r1595698 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/ log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/ log4j-core/src/main/java/org/apache/logging/log4j/core/async/ log4j-c...

Posted by Remko Popma <re...@gmail.com>.
Thank you! I didn't get a chance to work on this yesterday. 

Sent from my iPhone

> On 2014/05/19, at 6:52, ggregory@apache.org wrote:
> 
> Author: ggregory
> Date: Sun May 18 21:52:43 2014
> New Revision: 1595698
> 
> URL: http://svn.apache.org/r1595698
> Log:
> org.apache.logging.log4j.core.LogEvent.getContextMap() should never return null. Remove the getContextMap(String) API (aka getContextMapValue(String). The FlumeEvent is a little different and can indeed hold a null context map. All tests pass from Maven.
> 
> Modified:
>    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java
>    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
>    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java
>    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
>    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
>    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
>    logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/AbstractLogEvent.java Sun May 18 21:52:43 2014
> @@ -16,6 +16,7 @@
>  */
> package org.apache.logging.log4j.core;
> 
> +import java.util.Collections;
> import java.util.Map;
> 
> import org.apache.logging.log4j.Level;
> @@ -31,14 +32,12 @@ public abstract class AbstractLogEvent i
> 
>     private static final long serialVersionUID = 1L;
> 
> +    /**
> +     * Returns {@link Collections#emptyMap()}.
> +     */
>     @Override
>     public Map<String, String> getContextMap() {
> -        return null;
> -    }
> -
> -    @Override
> -    public String getContextMap(String key) {
> -        return null;
> +        return Collections.emptyMap();
>     }
> 
>     @Override
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java Sun May 18 21:52:43 2014
> @@ -34,21 +34,11 @@ public interface LogEvent extends Serial
>     /**
>      * Gets the context map (also know as MDC).
>      * 
> -     * @return A copy of the Mapped Diagnostic Context or null.
> +     * @return A copy of the Mapped Diagnostic Context, never {@code null}.
>      */
>     Map<String, String> getContextMap();
> 
>     /**
> -     * Gets the value at the given key in the context map.
> -     * 
> -     * @param key the key to query
> -     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
> -     *         map.
> -     */
> -    @Deprecated
> -    String getContextMap(String key);
> -
> -    /**
>      * Gets the context stack (also known as NDC).
>      * 
>      * @return A copy of the Nested Diagnostic Context or null;
> @@ -130,9 +120,9 @@ public interface LogEvent extends Serial
>     ThrowableProxy getThrownProxy();
> 
>     /**
> -     * Returns {@code true} if this event is the last one in a batch, {@code false} otherwise. Used by asynchronous
> -     * Loggers and Appenders to signal to buffered downstream components when to flush to disk, as a more efficient
> -     * alternative to the {@code immediateFlush=true} configuration.
> +     * Returns {@code true} if this event is the last one in a batch, {@code false} otherwise. Used by asynchronous Loggers and Appenders to
> +     * signal to buffered downstream components when to flush to disk, as a more efficient alternative to the {@code immediateFlush=true}
> +     * configuration.
>      * 
>      * @return whether this event is the last one in a batch.
>      */
> @@ -140,9 +130,8 @@ public interface LogEvent extends Serial
>     boolean isEndOfBatch();
> 
>     /**
> -     * Returns whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use
> -     * this flag to determine whether to take a {@code StackTrace} snapshot or not before handing off this event to
> -     * another thread.
> +     * Returns whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to
> +     * determine whether to take a {@code StackTrace} snapshot or not before handing off this event to another thread.
>      * 
>      * @return {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
>      * @see #getSource()
> @@ -151,22 +140,18 @@ public interface LogEvent extends Serial
>     boolean isIncludeLocation();
> 
>     /**
> -     * Sets whether this event is the last one in a batch. Used by asynchronous Loggers and Appenders to signal to
> -     * buffered downstream components when to flush to disk, as a more efficient alternative to the
> -     * {@code immediateFlush=true} configuration.
> +     * Sets whether this event is the last one in a batch. Used by asynchronous Loggers and Appenders to signal to buffered downstream
> +     * components when to flush to disk, as a more efficient alternative to the {@code immediateFlush=true} configuration.
>      * 
> -     * @param endOfBatch
> -     *            {@code true} if this event is the last one in a batch, {@code false} otherwise.
> +     * @param endOfBatch {@code true} if this event is the last one in a batch, {@code false} otherwise.
>      */
>     void setEndOfBatch(boolean endOfBatch);
> 
>     /**
> -     * Sets whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use
> -     * this flag to determine whether to take a {@code StackTrace} snapshot or not before handing off this event to
> -     * another thread.
> +     * Sets whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to determine
> +     * whether to take a {@code StackTrace} snapshot or not before handing off this event to another thread.
>      * 
> -     * @param locationRequired
> -     *            {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
> +     * @param locationRequired {@code true} if the source of the logging request is required downstream, {@code false} otherwise.
>      * @see #getSource()
>      */
>     void setIncludeLocation(boolean locationRequired);
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/BasicLogEventEntity.java Sun May 18 21:52:43 2014
> @@ -207,18 +207,6 @@ public abstract class BasicLogEventEntit
>     }
> 
>     /**
> -     * Gets the value at the given key in the context map.
> -     * 
> -     * @param key the key to query
> -     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
> -     *         map.
> -     */
> -    @Override
> -    public String getContextMap(String key) {
> -        return this.getWrappedEvent().getContextMap(key);
> -    }
> -
> -    /**
>      * Gets the context stack. Annotated with {@code @Convert(converter = ContextStackAttributeConverter.class)}.
>      *
>      * @return the context stack.
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java Sun May 18 21:52:43 2014
> @@ -164,15 +164,15 @@ public class RingBufferLogEvent implemen
>    }
> 
>    @Override
> -    public Throwable getThrown() {
> -        // after deserialization, thrown is null but thrownProxy may be non-null
> -        if (thrown == null) {
> -            if (thrownProxy != null) {
> -                thrown = thrownProxy.getThrowable();
> -            }
> -        }
> -  return thrown;
> -    }
> +    public Throwable getThrown() {
> +        // after deserialization, thrown is null but thrownProxy may be non-null
> +        if (thrown == null) {
> +            if (thrownProxy != null) {
> +                thrown = thrownProxy.getThrowable();
> +            }
> +        }
> +        return thrown;
> +    }
> 
>    @Override
>    public ThrowableProxy getThrownProxy() {
> @@ -190,11 +190,6 @@ public class RingBufferLogEvent implemen
>        return contextMap;
>    }
> 
> -    @Override
> -    public String getContextMap(String key) {
> -        return contextMap == null ? null : contextMap.get(key);
> -    }
> -
>    @Override
>    public ContextStack getContextStack() {
>        return contextStack;
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java Sun May 18 21:52:43 2014
> @@ -168,7 +168,7 @@ public class Log4jLogEvent implements Lo
>         this.level = (level == null) ? Level.OFF : level; // LOG4J2-462, LOG4J2-465
>         this.message = message;
>         this.thrownProxy = thrownProxy;
> -        this.contextMap = contextMap;
> +        this.contextMap = contextMap == null ? ThreadContext.EMPTY_MAP : contextMap;
>         this.contextStack = contextStack;
>         this.timeMillis = message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : timestamp;
>         this.threadName = threadName;
> @@ -287,7 +287,7 @@ public class Log4jLogEvent implements Lo
>      */
>     @Override
>     public Map<String, String> getContextMap() {
> -        return contextMap == null ? ThreadContext.EMPTY_MAP : contextMap;
> +        return contextMap;
>     }
> 
>     /**
> @@ -300,18 +300,6 @@ public class Log4jLogEvent implements Lo
>     }
> 
>     /**
> -     * Gets the value at the given key in the context map.
> -     * 
> -     * @param key the key to query
> -     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
> -     *         map.
> -     */
> -    @Override
> -    public String getContextMap(String key) {
> -        return contextMap == null ? null : contextMap.get(key);
> -    }
> -
> -    /**
>      * Returns the StackTraceElement for the caller. This will be the entry that occurs right
>      * before the first occurrence of FQCN as a class name.
>      * @return the StackTraceElement for the caller.
> 
> Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBaseEntity.java Sun May 18 21:52:43 2014
> @@ -143,11 +143,6 @@ public class TestBaseEntity extends Abst
>     }
> 
>     @Override
> -    public String getContextMap(String key) {
> -        return this.getWrappedEvent().getContextMap(key);
> -    }
> -
> -    @Override
>     @Transient
>     public ThreadContext.ContextStack getContextStack() {
>         return this.getWrappedEvent().getContextStack();
> 
> Modified: logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java?rev=1595698&r1=1595697&r2=1595698&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java (original)
> +++ logging/log4j/log4j2/trunk/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEvent.java Sun May 18 21:52:43 2014
> @@ -295,18 +295,6 @@ public class FlumeEvent extends SimpleEv
>     }
> 
>     /**
> -     * Gets the value at the given key in the context map.
> -     * 
> -     * @param key the key to query
> -     * @return the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key or there is no
> -     *         map.
> -     */
> -    @Override
> -    public String getContextMap(String key) {
> -        return contextMap == null ? null : contextMap.get(key);
> -    }
> -
> -    /**
>      * Returns a copy of the context stack.
>      * @return a copy of the context stack.
>      */
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org