[
https://issues.apache.org/jira/browse/GROOVY-10716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17574953#comment-17574953
]
Paul King commented on GROOVY-10716:
------------------------------------
>From reading the code, I think the design didn't really intend for
>loggingStrategy to ever be set in a custom fashion like you propose. There is
>no javadoc about that field, so I guess the original intention isn't revealed
>anywhere. The intention was that you'd create a new custom annotation to match
>your custom strategy.
{code:java}
@interface MyLogger {
...
Class<? extends LogASTTransformation.LoggingStrategy> loggingStrategy()
default MyStrategy.class;
...
}
{code}
> Impossible to change logging Strategy in @Slf4j and other log annotations
> -------------------------------------------------------------------------
>
> Key: GROOVY-10716
> URL: https://issues.apache.org/jira/browse/GROOVY-10716
> Project: Groovy
> Issue Type: Bug
> Components: ast builder
> Affects Versions: 4.0.2, 4.0.3
> Reporter: Alexander Kotikhov
> Priority: Major
> Attachments: createLoggingStrategy-snippet.java
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I defined a groovy class with @Slf4j annotation with custom logging strategy,
> like this:
> {code:groovy}
> @Slf4j(loggingStrategy=MyStrategy)
> class Foo {
> public String getFoo() {
> log.error("Hi")
> }
> }
> {code}
> But it remains use the original strategy.
> The problem is in the LogASTTransformation#createLoggingStrategy method where
> loggingStrategy is always obtained from the default value.
> Attachment contains source of fixed method.
> Please include the fix into the nearest release.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)