Add log4j2-levels module: threshold rule, inheritance, additivity, custom levels, Actuator runtime changes and argument evaluation on Spring Boot 4.1.2 / Log4j2 2.25.5, with real transcripts

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5SFkZoaMCukJNvZCV
This commit is contained in:
asmhatre
2026-11-17 23:20:53 +05:30
co-authored by Claude Sonnet 5.5
parent fe3fc689a6
commit c9a2b766bb
44 changed files with 1508 additions and 0 deletions
@@ -0,0 +1,32 @@
# log4j2-spring.xml says: com.ankurm.log4j2levels.service = DEBUG, root = INFO
# 1. --logging.level.com.ankurm.log4j2levels.service=WARN on the command line
{"configuredLevel":"WARN","effectiveLevel":"WARN"} [HTTP 200]
# 2. the same override as an environment variable
{"configuredLevel":"TRACE","effectiveLevel":"TRACE"} [HTTP 200]
# 3. --logging.level.root=ERROR, which the XML's root level should be competing with
{"effectiveLevel":"ERROR"} [HTTP 200]
# 4. a custom level through the property: --logging.level.com.ankurm.log4j2levels.service=DIAG
app did not start; first lines of its output:
ERROR o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'logging.level.com.ankurm.log4j2levels.service' to org.springframework.boot.logging.LogLevel:
Property: logging.level.com.ankurm.log4j2levels.service
Value: "DIAG"
Origin: "logging.level.com.ankurm.log4j2levels.service" from property source "commandLineArgs"
Reason: failed to convert java.lang.String to org.springframework.boot.logging.LogLevel (caused by java.lang.IllegalArgumentException: No enum constant org.springframework.boot.logging.LogLevel.DIAG)
Action:
Update your application's configuration. The following values are valid:
DEBUG
ERROR
FATAL
INFO
# 5. a custom level in a separate logger written as log4j2 itself reads it (see diag in the XML)
{"configuredLevel":"DIAG","effectiveLevel":"DIAG"} [HTTP 200]