iloveeyjafjalla opened a new pull request, #11401:
URL: https://github.com/apache/rocketmq/pull/11401

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11400
   
   ### Brief Description
   
   `ChangeLogLevel` only set the root logger's level, while the shipped 
`rmq.proxy.logback.xml` pins 20 component loggers with
   their own level and `additivity="false"`:
   
   ```xml
   <logger name="RocketmqProxy" additivity="false" level="INFO">
   ```
   
   In Logback a logger with an explicit level does not inherit the root's, so 
with the shipped configuration the RPC answered
   "log level changed to DEBUG" while every application logger kept logging at 
`INFO` — the documented on-demand troubleshooting
   switch was inert for exactly the logs an operator wants to raise.
   
   The change applies the requested level to the root logger **and** to the 
loggers that carry an explicit level (those are the
   ones the configuration pinned), which is what makes the runtime change 
observable. `docs/proxy-admin.md` §4 and
   `docs/proxy-admin-zh.md` §4 are updated to describe that mechanism instead 
of "root logger" only.
   
   ### How Did You Test This Change?
   
   New test 
`ProxyAdminGrpcServiceTest#changeLogLevelAppliesToOneOfThePinnedComponentLoggersTest`:
 it pins the proxy's component
   logger at `INFO` the way the shipped configuration does, calls 
`ChangeLogLevel(DEBUG)` and asserts that
   `LoggerFactory.getLogger(LoggerName.PROXY_LOGGER_NAME).isDebugEnabled()` is 
true (the logger's original level is restored in a
   `finally`).
   
   Results on Temurin JDK 8 (same JDK as CI), base `a7edeecfb` plus this patch:
   
   - before the fix: `java.lang.AssertionError: a logger pinned by the 
configuration has to observe the runtime change`
   - after the fix: `ProxyAdminGrpcServiceTest` — 61 tests, 0 failures
   - `mvn -B -ntp -pl proxy package` with checkstyle + spotbugs enabled: `BUILD 
SUCCESS`, spotbugs `BugInstance size is 0`
   
   Reviewer note: if root-only behaviour is intended instead, the alternative 
is to keep the handler as it was and document the
   boundary in §8; the PR description of #10826 says the surface "never fills a 
field it cannot truthfully supply", and a remark
   claiming a level change that no logger observes is the same class of claim. 
I am happy to switch to that variant.
   
   This change was prepared with AI assistance (analysis, patch and test 
drafting); the diff and every result above were
   reproduced locally by running the module's tests against the base commit and 
the patched tree.
   


-- 
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]

Reply via email to