LOG4J2-2892 - Add support for newline delimited messages in GelfLayout#394
Merged
rgoers merged 2 commits intoapache:masterfrom Aug 16, 2020
Merged
LOG4J2-2892 - Add support for newline delimited messages in GelfLayout#394rgoers merged 2 commits intoapache:masterfrom
rgoers merged 2 commits intoapache:masterfrom
Conversation
rgoers
reviewed
Aug 6, 2020
Member
rgoers
left a comment
There was a problem hiding this comment.
I've sanity tested what you are trying to do and am OK with the change but please add the requested items.
|
|
||
| @Test | ||
| public void testLayoutNewLineDelimiter() throws Exception { | ||
| testCompressedLayout(CompressionType.OFF, false, true, HOSTNAME, false, true); |
Member
There was a problem hiding this comment.
Please include a test that includes the stack trace.
| @@ -222,37 +224,42 @@ private void testCompressedLayout(final CompressionType compressionType, final b | |||
|
|
|||
Member
There was a problem hiding this comment.
I don't see any code added to validate that the newline is present.
Author
|
@rgoers Thank you for the quick review. There was no test whether the null byte delimiter is present so I've added that one as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pull request for issue https://issues.apache.org/jira/browse/LOG4J2-2892.
This PR adds ability to delimit Graylog Extended Log Format (GELF) messages with a newline. It can be useful when you want to append messages in the Graylog format into a file, or when you have to feed the messages into a consumer which supports only newlines as a delimiter. The documentation of GELF only specifies usage of a NULL delimiter and doesn't discourage from using some other. It also requires that newlines inside the message body must be escaped, so multi-line stack traces shouldn't be an issue.
New optional boolean parameter "includeNewLineDelimiter" is introduced to GelfLayout, nothing changes for current users if they decide not to use it.