Skip to content

ParameterizedLogging recipe doesn't support Log4j2 lambda method #167

@jeffreye

Description

@jeffreye

Originally reported in #159 but haven't fully fixed.
This report will include the leftover only.

What version of OpenRewrite are you using?

I am using

  • OpenRewrite v5.35.0
  • Maven/Gradle plugin v3.9.8
  • rewrite-logging-frameworks v2.10.0

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>5.35.0</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.logging.log4j.ParameterizedLogging</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-logging-frameworks</artifactId>
                        <version>2.10.0</version>
                    </dependency>
                </dependencies>
            </plugin>

What is the smallest, simplest way to reproduce the problem?

@Log4j2
class A {
    public static final Marker MY_MARKER = MarkerManager.getMarker("my-A");
    void foo(String bar) {
        log.debug(MY_MARKER, () -> bar);
    }
}

What did you expect to see?

@Log4j2
class A {
    public static final Marker MY_MARKER = MarkerManager.getMarker("my-A");
    void foo(String bar) {
        log.debug(MY_MARKER, () -> bar);
    }
}

What did you see instead?

@Log4j2
class A {
    public static final Marker MY_MARKER = MarkerManager.getMarker("my-A");
    void foo(String bar) {
        log.debug("{}", MY_MARKER, () -> bar);
    }
}

What is the full stack trace of any errors you encountered?

stacktrace output here

Are you interested in contributing a fix to OpenRewrite?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions