[
https://issues.apache.org/jira/browse/LOG4J2-3017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17283108#comment-17283108
]
Volkan Yazici commented on LOG4J2-3017:
---------------------------------------
[~rgoers], regarding your following remark:
> I don't believe I would want to modify the logic of the Object methods to
> inspect the type as that would either require a dependency on Groovy, the use
> of reflection or hardwiring the comparison of class names.
We can have an {{optional}} runtime dependency on Groovy and leverage it as
follows:
{code:java}
import groovy.lang.GString;
public final class GroovyUtils {
private static final boolean GROOVY_GSTRING_AVAILABLE =
isGroovyGStringAvailable();
private static boolean isGroovyGStringAvailable() {
try {
Class.forName("groovy.lang.GString", false, null);
return true;
} catch (ClassNotFoundException ignored) {
return false;
}
}
public static boolean isGroovyGString(Object instance) {
return GROOVY_GSTRING_AVAILABLE && instance instanceof GString;
}
private GroovyUtils() {}
}
{code}
We can use this check and treat {{GString}} instances accordingly. But again, I
am not sure about the stretch of this approach.
This said, ideally, Groovy should fix this issue, IMHO.
> 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)