-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All newlines in short messages are replaced with whitespaces #100
Comments
The current implementation does indeed seem to be doing too much. Would you like to send a pull request that changes that without breaking the class’s interface? |
Yes, I would send a pull request, but I need additional information. What is the expected behavior of
This could simply be implemented like this:
|
|
I'd say, it should:
Stripping whitespaces could be optional (configurable). |
I just created the PR #101, which does not include the option to strip inner whitespaces. But I wonder, if we should rethink the design:
|
PR #101 is now mergeable. What do you think of my previous comment? |
I think, you're absolutely right! I built the whole sanitising logic based on the misunderstanding of Graylog2/graylog2-server#4842 Formatting the message itself (including shortening, trimming, etc.) should be the sole responsibility of the pattern layout. Only the blank string handling has to be addresses – as you pointed out. Could you create another PR for that? |
PR #102 is mergeable. Will there be a patch or minor release soon? |
A major release (due to breaking changes) is planned within the next two weeks. |
Just released 6.0.0 - thanks for your contribution! |
Describe the bug
Since the graylog server does not accept empty ("") short messages,
GelfEncoder
class replaces them with "Empty message replaced by logback-gelf". A blank ("\n") short message is replaced, too.But the current implementation of
sanitizeShortMessage
replaces every newline with a whitespace.Thus a non-blank short message with linebreaks gets squashed and is finally less readable in graylog ui.
The above mentioned issue 4842 for graylog2-server states:
It refers to a single newline, so the current implementation maybe too strict.
To me it looks like the GELF Payload Specification does not totally deny newlines for short messages.
What do you think?
To Reproduce
Additional context
The text was updated successfully, but these errors were encountered: