sharanggupta opened a new pull request, #4414: URL: https://github.com/apache/logging-log4j2/pull/4414
Fixes #4412 `rewrite()` matched the configured logger name with `String.startsWith`, so a policy configured for `"com.foo"` also incorrectly matched an unrelated sibling package such as `"com.foobar.Baz"`, which merely shares the same character prefix without being a sub-logger of it. This is inconsistent with every other logger-name-hierarchy feature in Log4j (e.g. `<Logger name="com.foo">` configuration, which resolves by progressively truncating at the last dot, not by substring matching), and it silently rewrites/demotes log levels for packages the operator never intended to affect — a `WARN` from `com.foobar.Baz` could be silently demoted to `DEBUG` by a rule meant only for `com.foo`. Fix: require an exact match or a genuine `.`-separated descendant, matching the hierarchy semantics used everywhere else in the project. Added `LoggerNameLevelRewritePolicyTest.testPrefixMatchRespectsLoggerHierarchyBoundary` covering the sibling-package false match, the true child-logger case, and the exact-match case. `./mvnw test` for the `rewrite` package is green aside from one pre-existing, unrelated failure in `RewriteAppenderTest` that also reproduces on an unmodified checkout (confirmed before writing this, so it's not something this change introduced). Changelog entry included under `src/changelog/.2.x.x/`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
