[
https://issues.apache.org/jira/browse/LOG4J2-3017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283085#comment-17283085
]
Ralph Goers edited comment on LOG4J2-3017 at 2/11/21, 3:32 PM:
---------------------------------------------------------------
Yes, Logback and Log4j 1.2 only allow String values so the value will be
converted to a String when passed to those APIs. In the case of Log4j 2 it has
a method that accepts an Object, which is what a GString is to Java. That gets
turned into an ObjectMessage that then later within Log4j 2 will most likely be
converted to a String when it is processed by an Appender. I suspect that if
you call the toString() method on the GString on the logging call that the
problem would go away since one of Log4j's String methods would be used instead.
was (Author: [email protected]):
Yes, Logback and Log4j 1.2 only allow String values so the value will be
converted to a String when passed to those APIs. In the case of Log4j 2 it has
a method that accepts an Object, which is what a GString is to Java. That gets
turned into an ObjectMessage that then later within Log4j 2 will most likely be
converted to a String when it is processed by an Appender. I suspect that if
you could cast the GString to a java.lang.String on the logging call that the
problem would go away since one of Log4j's String methods would be used instead.
> Groovy logging of GString with $ notation is very slow
> ------------------------------------------------------
>
> Key: LOG4J2-3017
> URL: https://issues.apache.org/jira/browse/LOG4J2-3017
> Project: Log4j 2
> Issue Type: Improvement
> Reporter: Liviu Carausu
> Assignee: Volkan Yazici
> Priority: Major
> Attachments: SomeClass.groovy, TestLogging.groovy
>
>
>
> Logging of GString is very slow.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)