You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/04/15 14:48:32 UTC
[5/7] logging-log4j2 git commit: LOG4J2-1334 added
Log4jLogEvent.serialize(LogEvent,
boolean) method to allow serialization/copy of any LogEvent (regardless of
implementation)
LOG4J2-1334 added Log4jLogEvent.serialize(LogEvent, boolean) method to allow serialization/copy of any LogEvent (regardless of implementation)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/71fbda80
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/71fbda80
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/71fbda80
Branch: refs/heads/LOG4J2-1365
Commit: 71fbda804e3d75ef77bdef57e37f5fb85267bd3e
Parents: 35d0689
Author: rpopma <rp...@apache.org>
Authored: Thu Apr 14 23:54:33 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Apr 14 23:54:33 2016 +0900
----------------------------------------------------------------------
.../apache/logging/log4j/core/impl/Log4jLogEvent.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/71fbda80/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 57b0dcc..c062259 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
@@ -634,8 +634,16 @@ public Log4jLogEvent(final String loggerName, final Marker marker, final String
return new LogEventProxy(this, this.includeLocation);
}
- public static Serializable serialize(final Log4jLogEvent event,
- final boolean includeLocation) {
+ public static Serializable serialize(final LogEvent event, final boolean includeLocation) {
+ if (event instanceof Log4jLogEvent) {
+ event.getThrownProxy(); // ensure ThrowableProxy is initialized
+ return new LogEventProxy((Log4jLogEvent) event, includeLocation);
+ } else {
+ return new LogEventProxy(event, includeLocation);
+ }
+ }
+
+ public static Serializable serialize(final Log4jLogEvent event, final boolean includeLocation) {
event.getThrownProxy(); // ensure ThrowableProxy is initialized
return new LogEventProxy(event, includeLocation);
}