Skip to content

Migrate internal plumbing DEBUG statements to TRACE level - #12714

Open
gnodet wants to merge 1 commit into
feature/12643-structured-problemsfrom
feature/trace-level-migration
Open

Migrate internal plumbing DEBUG statements to TRACE level#12714
gnodet wants to merge 1 commit into
feature/12643-structured-problemsfrom
feature/trace-level-migration

Conversation

@gnodet

@gnodet gnodet commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Migrates 70+ DEBUG log statements to TRACE in 6 areas that produce excessive noise under -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)
  • Adds TRACE to Slf4jConfiguration.Level enum so the logging system supports -Dmaven.logger.defaultLogLevel=trace as a system property for Maven core developers
  • DEBUG (-X) remains the right level for plugin development; TRACE is for Maven core developers diagnosing framework internals

Motivation

The TRACE level was added in the logging-foundation PR to separate two audiences:

  • DEBUG — plugin developers and power users diagnosing plugin behavior
  • TRACE — Maven core developers tracing internal framework mechanics

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 -X today and drowns out the signal plugin developers actually want.

What stays at DEBUG

  • Plugin parameter resolution, mojo configuration/loading (useful for plugin devs)
  • mvnup upgrade diagnostics
  • CLI bootstrap messages (uses o.a.m.api.cli.Logger which doesn't have TRACE)

Files changed (18 files, +108/-105)

Area Files Changes
Lifecycle engine LifecycleDebugLogger, BuildPlanExecutor, MultiThreadedBuilder 32 statements
Cache internals DefaultRequestCache, CacheConfigurationResolver 22 statements
Classrealm DefaultClassRealmManager 8 statements
Resolver DefaultArtifactDescriptorReader, relocation sources, TypeDeriver 8 statements
Model builder DefaultModelBuilder 8 statements
Plugin resolution DefaultPluginVersionResolver, DefaultPluginPrefixResolver 6 statements
Infrastructure Slf4jConfiguration, MavenSimpleConfiguration, CliUtils TRACE level support
Tests DefaultClassRealmManagerTest, LookupInvokerLoggingTest Updated mocks

PR chain

# PR Feature
1 #12694 Logging foundation
2 #12695 Build report
3 #12697 Console modes
4 #12698 Warning mode + diagnostics
5 #12699 mvnlog viewer
6 #12702 Structured problems pipeline
7 This PR TRACE level migration

Test plan

  • All modified modules compile cleanly
  • DefaultClassRealmManagerTest updated to verify trace() calls instead of debug()
  • LookupInvokerLoggingTest updated for new TRACE enum value
  • All tests pass in isolation (batch-mode flakiness in MavenInvokerTest is pre-existing)

🤖 Generated with Claude Code

- 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
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 84d77ae to b6a409b Compare August 9, 2026 08:11
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from c0b643f to 2a79603 Compare August 9, 2026 08:11
@gnodet
gnodet marked this pull request as ready for review August 9, 2026 08:11

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 maps TRACE to "error" — should add case TRACE -> "trace"
  • LogbackConfiguration.java (line 34-37): default -> ch.qos.logback.classic.Level.ERROR silently maps TRACE to ERROR — should add case 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant