Open MaxFichtelmann opened 1 week ago
@gastaldi can you help ?
@jamezp is that intentional or could it be considered a bug?
I think it's related to the new "let's point to the problematic code in the stack trace" feature.
@dmlloyd already fixed some of the issues in this patch: https://github.com/quarkusio/quarkus/commit/7e6c529629ea31e8c193110c8abe31aaa101b597 .
But I suppose in the case of NO_FORMAT
, we should also escape the message.
That being said, I remember @dmlloyd was quite unhappy about the approach so maybe it's time to go for a cleaner one. @dmlloyd maybe you could share what you had in mind? Someone might be interested in implementing it.
We will need a small fix for the backport though but I would very much like us to clean this up for the future if we can.
Yeah, this doesn't look like it's coming from the log manager. I'm not able to reproduce this outside of Quarkus.
I'm able to reproduce the problem, but what I'm grappling with is that I don't see why the problem doesn't occur outside of Quarkus. The code path seems very clear to me; the jboss-logging logger calls org.jboss.logmanager.Logger#log(java.lang.String, java.util.logging.Level, java.lang.String, java.lang.Throwable)
which sets the format to MESSAGE_FORMAT
instead of NO_FORMAT
. There is no intervening Quarkus code at this point.
Here's the partial stack trace which shows what's happening more clearly (the above trace shows the problem during log message replay so some of the interesting stack isn't visible there):
java.util.logging.ErrorManager: 1: Nested handler publication threw an exception
java.lang.IllegalArgumentException: Unmatched braces in the pattern.
at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:540)
at java.base/java.text.MessageFormat.<init>(MessageFormat.java:382)
at java.base/java.text.MessageFormat.format(MessageFormat.java:882)
at org.jboss.logmanager.ExtFormatter.formatMessageLegacy(ExtFormatter.java:133)
at org.jboss.logmanager.ExtFormatter.formatMessage(ExtFormatter.java:96)
at io.quarkus.devui.runtime.logstream.JsonFormatter.toJsonObject(JsonFormatter.java:30)
at io.quarkus.devui.runtime.logstream.MutinyLogHandler.doPublish(MutinyLogHandler.java:39)
at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:88)
at org.jboss.logmanager.ExtHandler.publishToNestedHandlers(ExtHandler.java:125)
at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.doPublish(QuarkusDelayedHandler.java:81)
at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:88)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:438)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:480)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:480)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:480)
at org.jboss.logmanager.Logger.logRaw(Logger.java:1089)
at org.jboss.logmanager.Logger.log(Logger.java:1052)
at org.jboss.logmanager.Logger.log(Logger.java:1064) // <== we set the format to `MESSAGE_FORMAT` here
at org.jboss.logging.JBossLogManagerLogger.doLog(JBossLogManagerLogger.java:43)
at org.jboss.logging.Logger.info(Logger.java:967)
at org.acme.Start.onStart(Start.java:13)
OK I think I found the difference; the ad-hoc handlers created by Quarkus do not extend ExtHandler
so everything gets forced back into MessageFormat
. I'm still doing a little follow-up research but I think that'll end up being the fix.
@dmlloyd should we merge #44565 to close this?
IMO yes. If the bug isn't fully fixed, it will be after the log manager release in a few days.
Merged it, thanks!
Reopening as the bug will be fixed when the logging manager is updated
It would be a good idea to add the kind/bug-external
label here, but I don't see it
I'm waiting for something to be unblocked on the infra side before making the change.
You can add triage/upstream
for now, I will adjust the labels in batch.
Describe the bug
Hi, I stumbled across this bug, when an exception message contained braces and
Log.error(e.getMessage(), e)
produced unexpected output instead of logging the message and stacktrace.Downgrading to quarkus 3.14.2 results in the expected behaviour - 3.14.3 fails.
Expected behavior
Message and Stacktrace should be logged
Actual behavior
The following stacktrace is printed:
How to Reproduce?
This can be reproduced with the following startup bean:
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
3.14.3 - 3.16.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response