Uploaded image for project: 'JBoss Log Manager'
  1. JBoss Log Manager
  2. LOGMGR-356

FORMAT_FAILURE when using the ExtHandler.publishToNestedHandlers() is invoked on a non-ExtHandler is used with a { in the message and parameters are later added

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.1.2.Final
    • None
    • None
    • None

      The ExtHandler.publishToNestedHandlers() creates a new ExtLogRecord when the when the child handler is not an ExtHandler. The new record is created with a formatted message and the parameters for the new record are set to null. However, the FormatStyle is set to MESSAGE_FORMAT by default with the ExtLogRecord.setMessage(String) method. This causes issues in Quarkus when an exception is logged.

      java.lang.IllegalArgumentException: can't parse argument number: world
      	at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1485)
      	at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:512)
      	at java.base/java.text.MessageFormat.<init>(MessageFormat.java:383)
      	at java.base/java.text.MessageFormat.format(MessageFormat.java:883)
      	at org.jboss.logmanager.ExtFormatter.formatMessageLegacy(ExtFormatter.java:133)
      	at org.jboss.logmanager.ExtFormatter.formatMessage(ExtFormatter.java:96)
      	at org.jboss.logmanager.formatters.ColorPatternFormatter.formatMessage(ColorPatternFormatter.java:129)
      	at org.jboss.logmanager.formatters.Formatters$16.renderRaw(Formatters.java:832)
      	at org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:227)
      	at org.jboss.logmanager.formatters.ColorPatternFormatter$ColorStep.render(ColorPatternFormatter.java:152)
      	at org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:90)
      	at org.jboss.logmanager.ExtFormatter$Delegating.format(ExtFormatter.java:196)
      	at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:58)
      	at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:54)
      	at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:88)
      	at io.quarkus.deployment.logging.LoggingResourceProcessor$2.accept(LoggingResourceProcessor.java:485)
      	at io.quarkus.deployment.logging.LoggingResourceProcessor$2.accept(LoggingResourceProcessor.java:420)
      	at io.quarkus.runtime.logging.LoggingSetupRecorder$7.publish(LoggingSetupRecorder.java:621)
      	at org.jboss.logmanager.ExtHandler.publishToNestedHandlers(ExtHandler.java:138)
      	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:921)
      	at org.jboss.logmanager.Logger.log(Logger.java:884)
      	at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:56)
      	at org.jboss.logging.Logger.infof(Logger.java:1189)
      	at org.acme.GreetingResource.hello(GreetingResource.java:15)
      	at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
      	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
      	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
      	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
      	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:637)
      	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
      	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
      	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
      	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
      	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
      	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      	at java.base/java.lang.Thread.run(Thread.java:1583)
      Caused by: java.lang.NumberFormatException: For input string: "world"
      	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
      	at java.base/java.lang.Integer.parseInt(Integer.java:662)
      	at java.base/java.lang.Integer.parseInt(Integer.java:778)
      	at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1483)
      	... 42 more
      

      Note this isn't necessarily a Quarkus only issue. If you later modify the LogRecord with new parameters and attempt to format a message that contains something like Hello {world}, you'd see the same issue.

      The fix is to simply use the ExtLogRecord.setMessage(String, FormatStyle) method and set the format style to NO_FORMAT.

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: