Again, no tests AND this is a special case. I mentioned on the ML porting the class from Commons Lang again to pick up the latest fixes, so we should look at it from the Commons POV.
If this class is really useful as Serializable, then I strongly suggest you make the changes in Commons Lang. Note that any Apache committer can commit to any Commons component. If you fell shy in that project, just create a Jira and I'll apply it. Gary ---------- Forwarded message ---------- From: <[email protected]> Date: Sun, Feb 28, 2016 at 8:48 PM Subject: [2/2] logging-log4j2 git commit: [LOG4J2-1300] Make remaing StrLookups serializable. To: [email protected] [LOG4J2-1300] Make remaing StrLookups serializable. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/21c2f4e1 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/21c2f4e1 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/21c2f4e1 Branch: refs/heads/master Commit: 21c2f4e15f11fc6ffd423710a3d64256dbfcf44d Parents: c575c00 Author: Matt Sicker <[email protected]> Authored: Sun Feb 28 22:48:29 2016 -0600 Committer: Matt Sicker <[email protected]> Committed: Sun Feb 28 22:48:29 2016 -0600 ---------------------------------------------------------------------- .../org/apache/logging/log4j/core/lookup/ContextMapLookup.java | 5 ++++- .../java/org/apache/logging/log4j/core/lookup/DateLookup.java | 4 +++- .../log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java | 1 + .../org/apache/logging/log4j/core/lookup/MainMapLookup.java | 1 + .../java/org/apache/logging/log4j/core/lookup/MapLookup.java | 4 +++- .../apache/logging/log4j/core/lookup/StructuredDataLookup.java | 5 ++++- 6 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java index 9a39338..534eb58 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java @@ -16,6 +16,8 @@ */ package org.apache.logging.log4j.core.lookup; +import java.io.Serializable; + import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.config.plugins.Plugin; @@ -24,7 +26,8 @@ import org.apache.logging.log4j.core.config.plugins.Plugin; * Looks up keys from {@link ThreadContext} objects.. */ @Plugin(name = "ctx", category = StrLookup.CATEGORY) -public class ContextMapLookup implements StrLookup { +public class ContextMapLookup implements StrLookup, Serializable { + private static final long serialVersionUID = 1L; /** * Looks up the value from the ThreadContext Map. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java index 3e630b0..c79b82b 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java @@ -16,6 +16,7 @@ */ package org.apache.logging.log4j.core.lookup; +import java.io.Serializable; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -31,7 +32,8 @@ import org.apache.logging.log4j.status.StatusLogger; * Formats the current date or the date in the LogEvent. The "key" is used as the format String. */ @Plugin(name = "date", category = StrLookup.CATEGORY) -public class DateLookup implements StrLookup { +public class DateLookup implements StrLookup, Serializable { + private static final long serialVersionUID = 1L; private static final Logger LOGGER = StatusLogger.getLogger(); private static final Marker LOOKUP = MarkerManager.getMarker("LOOKUP"); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java index 3dc2e5d..ba2bcd4 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JmxRuntimeInputArgumentsLookup.java @@ -30,6 +30,7 @@ import org.apache.logging.log4j.core.config.plugins.Plugin; */ @Plugin(name = "jvmrunargs", category = StrLookup.CATEGORY) public class JmxRuntimeInputArgumentsLookup extends MapLookup { + private static final long serialVersionUID = 1L; static { final List<String> argsList = ManagementFactory.getRuntimeMXBean().getInputArguments(); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MainMapLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MainMapLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MainMapLookup.java index a50de0d..7f9431f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MainMapLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MainMapLookup.java @@ -30,6 +30,7 @@ import org.apache.logging.log4j.core.config.plugins.Plugin; */ @Plugin(name = "main", category = StrLookup.CATEGORY) public class MainMapLookup extends MapLookup { + private static final long serialVersionUID = 1L; /** * A singleton used by a main method to save its arguments. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java index c369a0b..d624167 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java @@ -16,6 +16,7 @@ */ package org.apache.logging.log4j.core.lookup; +import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +29,8 @@ import org.apache.logging.log4j.message.MapMessage; * A map-based lookup. */ @Plugin(name = "map", category = StrLookup.CATEGORY) -public class MapLookup implements StrLookup { +public class MapLookup implements StrLookup, Serializable { + private static final long serialVersionUID = 1L; /** * Map keys are variable names and value. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/21c2f4e1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java index 379d6a9..1656b77 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java @@ -16,6 +16,8 @@ */ package org.apache.logging.log4j.core.lookup; +import java.io.Serializable; + import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.message.StructuredDataMessage; @@ -24,7 +26,8 @@ import org.apache.logging.log4j.message.StructuredDataMessage; * Looks up keys from {@link org.apache.logging.log4j.message.StructuredDataMessage} log messages. */ @Plugin(name = "sd", category = StrLookup.CATEGORY) -public class StructuredDataLookup implements StrLookup { +public class StructuredDataLookup implements StrLookup, Serializable { + private static final long serialVersionUID = 1L; /** * Returns {@code null}. This Lookup plugin does not make sense outside the context of a LogEvent. -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
