Repository: logging-log4j2 Updated Branches: refs/heads/LOG4J2-1694 0166ac20a -> 1c2ad7b80
LOG4J2-1854 Do not allow compression and null delimiter at the same time Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ffb21ad1 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ffb21ad1 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ffb21ad1 Branch: refs/heads/LOG4J2-1694 Commit: ffb21ad1651f60d779c4482a462f744ad01a41c6 Parents: 01d0f5a Author: Mikael Ståldal <[email protected]> Authored: Fri Apr 28 11:01:58 2017 +0200 Committer: Mikael Ståldal <[email protected]> Committed: Fri Apr 28 11:01:58 2017 +0200 ---------------------------------------------------------------------- .../java/org/apache/logging/log4j/core/layout/GelfLayout.java | 5 +++-- src/site/xdoc/manual/layouts.xml.vm | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffb21ad1/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java index 84970d2..386781c 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java @@ -28,10 +28,8 @@ import java.util.zip.DeflaterOutputStream; import java.util.zip.GZIPOutputStream; import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.Node; import org.apache.logging.log4j.core.config.plugins.Plugin; @@ -261,6 +259,9 @@ public final class GelfLayout extends AbstractStringLayout { this.includeStacktrace = includeStacktrace; this.includeThreadContext = includeThreadContext; this.includeNullDelimiter = includeNullDelimiter; + if (includeNullDelimiter && compressionType != CompressionType.OFF) { + throw new IllegalArgumentException("null delimiter cannot be used with compression"); + } } /** http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffb21ad1/src/site/xdoc/manual/layouts.xml.vm ---------------------------------------------------------------------- diff --git a/src/site/xdoc/manual/layouts.xml.vm b/src/site/xdoc/manual/layouts.xml.vm index 8c18d96..1020b9f 100644 --- a/src/site/xdoc/manual/layouts.xml.vm +++ b/src/site/xdoc/manual/layouts.xml.vm @@ -259,7 +259,7 @@ logger.debug("one={}, two={}, three={}", 1, 2, 3); <td>includeNullDelimiter</td> <td>boolean</td> <td>Whether to include NULL byte as delimiter after each event (optional, default to false). - Useful for Graylog GELF TCP input.</td> + Useful for Graylog GELF TCP input. Cannot be used with compression.</td> </tr> <caption align="top">GelfLayout Parameters</caption> </table>
