Migrate internal plumbing DEBUG statements to TRACE level - #12714
Conversation
- 70+ logger.debug() → logger.trace() across 15 source files in 6 areas: lifecycle engine, classrealm, cache internals, resolver, model builder, plugin resolution - Add TRACE to Slf4jConfiguration.Level enum - Activatable via -Dmaven.logger.defaultLogLevel=trace - DEBUG (-X) remains the right level for plugin development - TRACE is for Maven core developers diagnosing framework internals
84d77ae to
b6a409b
Compare
c0b643f to
2a79603
Compare
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ debug statements to trace level. MavenSimpleConfiguration, CliUtils, and tests are all correctly updated to handle the new Level.TRACE enum value.
Missing TRACE handling in two logging backends:
The new TRACE enum value is correctly handled in MavenSimpleConfiguration (case TRACE -> "trace"), CliUtils (case TRACE, DEBUG ->), and the test, but two other setRootLoggerLevel implementations were not updated:
Log4j2Configuration.java(line 32-36):default -> "error"silently mapsTRACEto"error"— should addcase TRACE -> "trace"LogbackConfiguration.java(line 34-37):default -> ch.qos.logback.classic.Level.ERRORsilently mapsTRACEto ERROR — should addcase TRACE -> ch.qos.logback.classic.Level.TRACE
Both are live code — registered in META-INF/maven/slf4j-configuration.properties as runtime-selected implementations. While Level.TRACE is not yet wired to a CLI option (limiting immediate impact), the inconsistency should be fixed to prevent a silent bug when trace-level CLI support lands.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
gnodet
left a comment
There was a problem hiding this comment.
Clean mechanical migration of 70+ internal DEBUG statements to TRACE level. All switch expressions, guard conditions, and tests are correctly updated.
Non-blocking observations:
LifecycleDebugLogger.debug(String)now callslogger.trace(), making the method name misleading. However, the class is non-public API and renaming would expand the scope unnecessarily.- Several trace log calls use string concatenation instead of parameterized logging (pre-existing, not introduced by this PR).
- Pre-existing arithmetic bug in
DefaultModelBuilder.java:2722:afterSize - beforeSizeproduces a negative count for removed entries. Should bebeforeSize - afterSize. This PR only changed the log level.
LGTM — the migration is well-scoped: only internal plumbing is demoted to TRACE, while plugin-facing DEBUG output correctly remains at DEBUG.
This review was generated by an AI agent (Claude Code) and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Summary
-X: lifecycle engine (reactor plan dumps, step scheduling), classrealm (realm creation/population/imports), cache internals (config resolution, access stats), resolver (descriptor filtering, relocation), model builder (cache clearing, profile activation), and plugin resolution (version/prefix tracing)TRACEtoSlf4jConfiguration.Levelenum so the logging system supports-Dmaven.logger.defaultLogLevel=traceas a system property for Maven core developersDEBUG(-X) remains the right level for plugin development;TRACEis for Maven core developers diagnosing framework internalsMotivation
The TRACE level was added in the logging-foundation PR to separate two audiences:
Without this migration, TRACE exists but nothing emits at it, making the distinction theoretical. This PR populates it with the noisiest internal plumbing output that dominates
-Xtoday and drowns out the signal plugin developers actually want.What stays at DEBUG
mvnupupgrade diagnosticso.a.m.api.cli.Loggerwhich doesn't have TRACE)Files changed (18 files, +108/-105)
LifecycleDebugLogger,BuildPlanExecutor,MultiThreadedBuilderDefaultRequestCache,CacheConfigurationResolverDefaultClassRealmManagerDefaultArtifactDescriptorReader, relocation sources,TypeDeriverDefaultModelBuilderDefaultPluginVersionResolver,DefaultPluginPrefixResolverSlf4jConfiguration,MavenSimpleConfiguration,CliUtilsDefaultClassRealmManagerTest,LookupInvokerLoggingTestPR chain
mvnlogviewerTest plan
DefaultClassRealmManagerTestupdated to verifytrace()calls instead ofdebug()LookupInvokerLoggingTestupdated for new TRACE enum valueMavenInvokerTestis pre-existing)🤖 Generated with Claude Code