Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue discovered on log4j-1.2-api/src/main/java/org/apache/log4j/bridge/LogEventAdapter.java with Parameterize logging statements #130

Open
JLLeitschuh opened this issue Dec 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@JLLeitschuh
Copy link

Problem

Reformatting occurs when no other modifications are made.

Expected behavior

When no changes are made to a logging callsite, no modifications should occur to the formatting.

Example diff

From: log4j-1.2-api/src/main/java/org/apache/log4j/bridge/LogEventAdapter.java

      return (Long) getStartTime.invoke(runtimeMXBean);
} catch (final Throwable t) {
StatusLogger.getLogger()
-                    .error(
-                            "Unable to call ManagementFactory.getRuntimeMXBean().getStartTime(), "
-                                    + "using system time for OnStartupTriggeringPolicy",
-                            t);
+                    .error("Unable to call ManagementFactory.getRuntimeMXBean().getStartTime(), using system time for OnStartupTriggeringPolicy", t);
// We have little option but to declare "now" as the beginning of time.
return System.currentTimeMillis();
}

Recipes in example diff:

  • org.openrewrite.java.logging.ParameterizedLogging

References:

  • View original result
  • Recipe ID: org.openrewrite.java.logging.ParameterizedLogging
  • Recipe Name: Parameterize logging statements
  • Repository: apache/logging-log4j2/2.x
  • Created at Mon Dec 11 2023 11:09:09 GMT-0500 (Eastern Standard Time)
@timtebeek timtebeek transferred this issue from openrewrite/rewrite Dec 11, 2023
@timtebeek
Copy link
Contributor

Do you mean to say that final t); should remain on it's own line?

@timtebeek timtebeek moved this to Backlog in OpenRewrite Dec 11, 2023
@timtebeek timtebeek added the bug Something isn't working label Dec 11, 2023
@JLLeitschuh
Copy link
Author

The string wasn't modified at all, I think that no change should have been generated as there was no parameterization performed here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants