rewrite-logging-frameworks
rewrite-logging-frameworks copied to clipboard
Issue discovered on `log4j-1.2-api/src/main/java/org/apache/log4j/bridge/LogEventAdapter.java` with `Parameterize logging statements`
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)
Do you mean to say that final t); should remain on it's own line?
The string wasn't modified at all, I think that no change should have been generated as there was no parameterization performed here