You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/05/09 16:19:51 UTC

logging-log4j2 git commit: LOG4J2-1382 added javadoc that the MutableLogEvent#createMemento() and Log4jLogEvent#serialize() methods obtain caller location information when requested.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master d380220d2 -> 320bcf4e1


LOG4J2-1382 added javadoc that the MutableLogEvent#createMemento() and Log4jLogEvent#serialize() methods obtain caller location information when requested.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/320bcf4e
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/320bcf4e
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/320bcf4e

Branch: refs/heads/master
Commit: 320bcf4e1bc6289de197b537f73d5a03a74194fc
Parents: d380220
Author: rpopma <rp...@apache.org>
Authored: Tue May 10 01:20:19 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue May 10 01:20:19 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/impl/Log4jLogEvent.java    | 18 ++++++++++++++++++
 .../logging/log4j/core/impl/MutableLogEvent.java  |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/320bcf4e/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
index 1ba20c9..69a8a22 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
@@ -637,6 +637,15 @@ public Log4jLogEvent(final String loggerName, final Marker marker, final String
         return new LogEventProxy(this, this.includeLocation);
     }
 
+    /**
+     * Take a snapshot of the specified {@code LogEvent}.
+     *
+     * @param event the event to take a snapshot of
+     * @param includeLocation if true, this method will obtain caller location information
+     * @return snapshot of the event as a {@code Serializable} object
+     * @see #deserialize(Serializable)
+     * @see #serialize(Log4jLogEvent, boolean)
+     */
     public static Serializable serialize(final LogEvent event, final boolean includeLocation) {
         if (event instanceof Log4jLogEvent) {
             event.getThrownProxy(); // ensure ThrowableProxy is initialized
@@ -645,6 +654,15 @@ public Log4jLogEvent(final String loggerName, final Marker marker, final String
         return new LogEventProxy(event, includeLocation);
     }
 
+    /**
+     * Take a snapshot of the specified {@code Log4jLogEvent}.
+     *
+     * @param event the event to take a snapshot of
+     * @param includeLocation if true, this method will obtain caller location information
+     * @return snapshot of the event as a {@code Serializable} object
+     * @see #deserialize(Serializable)
+     * @see #serialize(LogEvent, boolean)
+     */
     public static Serializable serialize(final Log4jLogEvent event, final boolean includeLocation) {
         event.getThrownProxy(); // ensure ThrowableProxy is initialized
         return new LogEventProxy(event, includeLocation);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/320bcf4e/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
index 02e67a7..6e806af 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/MutableLogEvent.java
@@ -421,11 +421,11 @@ public class MutableLogEvent implements LogEvent, ReusableMessage {
 
     /**
      * Creates and returns a new immutable copy of this {@code MutableLogEvent}.
+     * If {@link #isIncludeLocation()} is true, this will obtain caller location information.
      *
      * @return a new immutable copy of the data in this {@code MutableLogEvent}
      */
     public Log4jLogEvent createMemento() {
-        // TODO implement MutableLogEvent.createMemento()
         return Log4jLogEvent.deserialize(Log4jLogEvent.serialize(this, includeLocation));
     }