This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
Fix formatting with single quote arguments for String.format with JUL #225
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.
Make sure that:
Hey Mark,
we are using logstash-gelf for Applications on JBoss EAP 7.
We noticed that some of the JBoss startup messages are not displayed properly when sending via logstash-gelf.
Example after formatting:
WFLYEJB0473: JNDI bindings for session bean named %s in deployment unit %s are as follows:%s
Message Format Template:
JNDI bindings for session bean named '%s' in deployment unit '%s' are as follows:%s
This message comes from Wildfly (see the following line in Wildfly: https://github.com/wildfly/wildfly/blob/cd1a5e2393052f3a91e77e581dfeee839d6f819d/ejb3/src/main/java/org/jboss/as/ejb3/logging/EjbLogger.java#L3059 ).
The log message has single quotes which get removed by the MessageFormat call. Afterwards a subsequent String.format will not be applied (because the String was changed and is now missing the single quotes).
One easy fix for that is to check whether there is a MessageFormat identifier ("{") inside the message and skip MessageFormat if that's not the case.
Although this won't solve all cases it should be good enough to fix the Startup Messages and not break something else.