[
https://issues.apache.org/jira/browse/LOG4J2-3017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283552#comment-17283552
]
Liviu Carausu commented on LOG4J2-3017:
---------------------------------------
Hi, thank you all for your thoughts. We have just upgraded from log4j1.2 to
log4j 2 and we had this unexpected effect. Because there are already hundreds
of Groovy scripts outside which are using our framework, checking all of them
for the usage of GString with $ is not really an option. We thought about
writing a custom MessageFactory to workaround this.
Basically what we have to do is to implement the newMessage(Object message)
and to early convert the GString to a String before it goes to the normal
MessageFactory.
{code:java}
@Override
public Message newMessage(Object message)
{
if (message instanceof GString)
{
return delegate.newMessage(message.toString());
}
else
{
return delegate.newMessage(message);
}
}
{code}
Are there any best practices or examples how to do that ? How should I safely
choose the right delegate there to be sure that the rest of the calls are
remaining unaffected by this custom Message Factory ?
Thank you so much !
> 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)