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
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Transcripts 11 and 12: what happens when Logback and Log4j2 are both on the classpath, and the
# dependency tree of the working build next to the broken one.
set -uo pipefail
source "$(dirname "$0")/lib.sh"
mkdir -p output
[ -f "$JAR" ] || mvn -B -q package -DskipTests
mvn -B -q -f broken/pom.xml package -DskipTests 2>&1 | grep -E 'ERROR|BUILD' | head -5
{
echo "# the same sources and the same dependencies as the module, minus the <exclusions> on spring-boot-starter-logging"
echo "\$ java -jar broken/target/log4j2-levels-both-logging-1.0.0.jar"
java -jar broken/target/log4j2-levels-both-logging-1.0.0.jar --server.port=18097 > /tmp/l4j-both.log 2>&1 &
BOTH=$!
for _ in $(seq 1 30); do kill -0 "$BOTH" 2>/dev/null || break; sleep 1; done
if kill -0 "$BOTH" 2>/dev/null; then
echo "(still running after 30 s: the application started)"
echo "\$ curl 'localhost:18097/demo/log?name=com.ankurm.log4j2levels.service.Probe' (the XML sets this package to DEBUG)"
curl -s --noproxy '*' "localhost:18097/demo/log?name=com.ankurm.log4j2levels.service.Probe" ; echo
echo "\$ curl localhost:18097/actuator/loggers/com.ankurm.log4j2levels.service"
curl -s --noproxy '*' "localhost:18097/actuator/loggers/com.ankurm.log4j2levels.service" ; echo
kill "$BOTH"; wait "$BOTH" 2>/dev/null
else
wait "$BOTH"; echo "exit code: $?"
fi
echo; echo '# what the application printed (SLF4J startup notes, then the lines from the request above)'
grep -E 'SLF4J|Probe' /tmp/l4j-both.log
} > output/11-both-logging.txt 2>&1
{
FILTER='org.apache.logging.log4j,ch.qos.logback,org.slf4j'
echo "# mvn dependency:tree for the module (Log4j2 only)"
mvn -B -f pom.xml dependency:tree -Dincludes="$FILTER" -DoutputFile=/tmp/l4j-tree-good.txt > /dev/null 2>&1
sed 's/^/ /' /tmp/l4j-tree-good.txt
echo
echo "# mvn dependency:tree for broken/pom.xml (exclusions removed)"
mvn -B -f broken/pom.xml dependency:tree -Dincludes="$FILTER" -DoutputFile=/tmp/l4j-tree-bad.txt > /dev/null 2>&1
sed 's/^/ /' /tmp/l4j-tree-bad.txt
} > output/12-dependency-tree.txt 2>&1
echo "wrote output/11-both-logging.txt and output/12-dependency-tree.txt"