GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Migrate internal plumbing DEBUG statements to TRACE level by gnodet · Pull Request #12714 · apache/maven

Conversation

@gnodet

@gnodet gnodet commented Aug 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Migrates ~70 DEBUG log statements to TRACE in internal plumbing code:
    lifecycle engine, classrealm, cache internals, resolver, plugin resolution
  • 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

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

Status

This PR is now independent — rebased onto master with no dependency on the
logging PR stack. The original stacked version included unrelated DefaultModelBuilder
changes from the base branch; those have been removed.

Files changed (17 files)

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

Test plan

  • Compilation passes
  • DefaultClassRealmManagerTest passes (mock expectations updated)
  • LookupInvokerLoggingTest passes (new TRACE enum value)
  • CI validation

Related

  • Build output overhaul: structured build report, diagnostic collector, console modes #12571 — Build output overhaul tracking issue

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Aug 9, 2026
Logging foundation: structured LogEvent, JUL handler, Log API enhancements #12694
Closed
Build report: structured JSON report with per-mojo log capture #12695
Closed
Console modes: --console=plain/rich/verbose/machine #12697
Closed
Warning mode, diagnostic collector, BuilderProblem enrichments #12698
Closed
mvnlog: build log viewer, integration tests, script routing #12699
Closed
Structured BuilderProblem pipeline for DiagnosticCollector #12702
Closed
@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 commented Aug 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet commented Aug 16, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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+ internal DEBUG statements to TRACE level. All switch expressions, guard conditions, and tests are correctly updated.

Non-blocking observations:

  • LifecycleDebugLogger.debug(String) now calls logger.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 - beforeSize produces a negative count for removed entries. Should be beforeSize - 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet added a commit to gnodet/maven that referenced this pull request Aug 16, 2026
@gnodet
Update STATE.md — run 9: reviewed apache#12714, apache#12658, apache#…
cda9f52
…12716
@gnodet gnodet added this to the 4.1.0 milestone Aug 23, 2026
gnodet
gnodet commented Aug 24, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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+ internal DEBUG statements to TRACE level across 18 files. All switch expressions, guard conditions, and tests are correctly updated.

The migration scoping is well-reasoned: only internal framework plumbing (lifecycle engine, classrealm, cache internals, resolver, model builder, plugin resolution) is demoted to TRACE. Plugin-facing DEBUG output (parameter resolution, mojo configuration) correctly remains at DEBUG, preserving the signal that plugin developers need from -X.

Note: the two prior AI-generated reviews flagged Log4j2Configuration and LogbackConfiguration as missing TRACE handling — this is a false positive since both files were removed in an earlier PR in the chain and do not exist on the target branch feature/12643-structured-problems.

Looks good overall. ✅


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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 2a79603 to 6eff81f Compare August 28, 2026 09:28
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from b6a409b to 4b6969b Compare August 28, 2026 09:28
gnodet
gnodet commented Aug 28, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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+ internal DEBUG statements to TRACE across 18 files. The scoping is well-reasoned — only internal framework plumbing (lifecycle engine, classrealm, cache internals, resolver, model builder, plugin resolution) is demoted to TRACE, while plugin-facing DEBUG output (parameter resolution, mojo configuration) correctly remains at DEBUG.

The Slf4jConfiguration.Level enum update is correctly propagated to MavenSimpleConfiguration, and the CliUtils mapping functions correctly map TRACE to the same level as DEBUG for legacy APIs that lack a TRACE concept.

A few minor pre-existing observations (not introduced by this PR):

  • DefaultModelBuilder.java line ~2722: afterSize - beforeSize produces a negative value when reporting "removed {} entries" — should be beforeSize - afterSize
  • LifecycleDebugLogger: Several trace log calls use string concatenation instead of parameterized logging ("Project: " + ... vs "Project: {}", ...)
  • The compat/maven-resolver-provider TypeDeriver still has debug() calls for the same messages migrated to trace() in the impl/ version — acceptable since compat modules are legacy wrappers

LGTM — the rebase introduced no content changes and the migration is correct throughout.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 4b6969b to 3b439d0 Compare August 28, 2026 09:55
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 6eff81f to 6c40a9e Compare August 28, 2026 09:55
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 3b439d0 to 5f53884 Compare August 28, 2026 10:16
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 6c40a9e to 7a6b6ad Compare August 28, 2026 10:16
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 5f53884 to a964976 Compare August 31, 2026 08:55
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 7a6b6ad to 2d77564 Compare August 31, 2026 08:55
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from a964976 to 33f16e8 Compare September 18, 2026 11:11
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 2d77564 to 0d2db3b Compare September 18, 2026 11:11
@gnodet
gnodet force-pushed the feature/12643-structured-problems branch from 33f16e8 to 0661b09 Compare September 18, 2026 11:21
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from 0d2db3b to b282ea5 Compare September 18, 2026 11:21
@gnodet gnodet mentioned this pull request Sep 18, 2026
Console modes: --console=plain/rich/verbose/machine #13180
Draft
gnodet-bot
gnodet-bot suggested changes Sep 18, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The logging migration itself (DEBUG → TRACE for 70+ statements) is clean and well-scoped. The Slf4jConfiguration.Level.TRACE enum addition, switch propagation in CliUtils/MavenSimpleConfiguration, and test updates are all correct.

However, the DefaultModelBuilder.java diff includes several non-logging functional changes that revert or weaken fixes that were already present on the base branch (feature/12643-structured-problems). These need to be addressed before merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java Outdated
// to prevent StackOverflowError from path representation mismatches (GH-12598).
Path normalizedPath =
sourcePath != null ? sourcePath.toAbsolutePath().normalize() : null;
Path normalizedPath = sourcePath != null ? sourcePath.normalize() : null;

@gnodet-bot gnodet-bot Sep 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

⚠️ Regression (GH-12598): sourcePath.normalize() without toAbsolutePath()

The base branch used sourcePath.toAbsolutePath().normalize() here to ensure a canonical, absolute path is stored in activeModelReads. The comment that was removed explicitly explained why:

Use toAbsolutePath().normalize() for consistent path identity in activeModelReads. This must match the normalization used in getEnhancedProperties() guard check to prevent StackOverflowError from path representation mismatches (GH-12598).

With only .normalize(), a relative sourcePath (e.g. when modelSource.getPath() returns a relative Path) will be stored as-is. The guard in getEnhancedProperties at line 751 uses rootModelPath.normalize() — also without toAbsolutePath(). If the two paths represent the same file but one is absolute and one is relative, the contains() check returns false and the StackOverflow reappears on projects that triggered GH-12598.

Suggested change
Path normalizedPath = sourcePath != null ? sourcePath.normalize() : null;
Path normalizedPath = sourcePath != null ? sourcePath.toAbsolutePath().normalize() : null;

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java Outdated
if (isParentWithinRootDirectory(rootModelPath, rootDirectory)
&& !activeModelReads.contains(
rootModelPath.toAbsolutePath().normalize())) {
&& !activeModelReads.contains(rootModelPath.normalize())) {

@gnodet-bot gnodet-bot Sep 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

⚠️ Regression (GH-12301/GH-12598): rootModelPath.normalize() without toAbsolutePath()

The base branch guard was rootModelPath.toAbsolutePath().normalize() to match the identity of entries put into activeModelReads by doReadFileModel. That comment was deleted here:

Use toAbsolutePath().normalize() for the guard check to handle paths obtained via different representations (e.g., symlinks, relative segments).

The rootModelPath comes from modelProcessor.locateExistingPom(rootDirectory). If that returns a relative or symlinked path while the entry in activeModelReads is an absolute path (or vice versa), the cycle guard fires when it shouldn't, or misses when it should fire.

Suggested change
&& !activeModelReads.contains(rootModelPath.normalize())) {
&& !activeModelReads.contains(rootModelPath.toAbsolutePath().normalize())) {

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java Outdated
return dominant;
return List.copyOf(
request.getRepositories() != null
? request.getRepositories()

@gnodet-bot gnodet-bot Sep 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

⚠️ Regression (MNG-12769): mergeRepositoriesById removed

The base branch's repos() method called mergeRepositoriesById() which merged duplicate repo entries (same ID, different snapshot/release policies) that mirror injection can produce. The Javadoc explained:

Without this merge, policy deduplication in the resolver can drop the snapshot policy, causing SNAPSHOT parent resolution to fail (MNG-12769).

This PR replaces repos() with a plain List.copyOf(...), silently reintroducing the MNG-12769 bug for projects that use mirrors with split release/snapshot policies.

The fix should be re-applied here, or moved to a layer below ModelBuilderSessionState if the intent is to clean up its scope.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet gnodet added the maintenance label Oct 14, 2026
@gnodet gnodet added the mvn4 label Oct 14, 2026
This was referenced Oct 15, 2026
feat: add BuildInvocation API to Session #13542
Merged
Build output overhaul: structured build report, diagnostic collector, console modes #12571
Open
@gnodet @claude
Migrate internal plumbing DEBUG statements to TRACE level
fdab681
Migrates ~70 DEBUG log statements to TRACE in internal plumbing code:
lifecycle engine, classrealm, cache internals, resolver, plugin resolution.

DEBUG (-X) remains the right level for plugin development.
TRACE is for Maven core developers diagnosing framework internals,
accessible via -Dmaven.logger.defaultLogLevel=trace.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gnodet
gnodet force-pushed the feature/trace-level-migration branch from b282ea5 to fdab681 Compare October 16, 2026 09:31
@gnodet
gnodet changed the base branch from feature/12643-structured-problems to master October 16, 2026 09:31
gnodet-bot
gnodet-bot suggested changes Oct 16, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Following up on my earlier review — the DefaultModelBuilder.java issues (sourcePath normalization, rootModelPath normalization, mergeRepositoriesById) are all resolved: the PR has been rebased onto master and those changes have been removed from the diff entirely. ✅

The logging migration itself is clean and correctly applied across all 17 files. One issue remains before merge:

Missing case TRACE in LogbackConfiguration and Log4j2Configuration

MavenSimpleConfiguration was correctly updated with case TRACE -> "trace". But two sibling implementations were not:

  • LogbackConfiguration.java (line 34–37): uses default -> ch.qos.logback.classic.Level.ERROR, so Level.TRACE maps silently to ERROR
  • Log4j2Configuration.java (line 32–35): uses default -> "error", same silent failure

Currently no code path sets context.loggerLevel = Level.TRACE in LookupInvoker, so this is latent. But the PR description explicitly advertises -Dmaven.logger.defaultLogLevel=trace support — when that path is wired, users on Logback/Log4j2 backends will get ERROR output instead of TRACE with zero diagnostic indication. Add explicit case TRACE arms to both.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-cli/src/main/java/org/apache/maven/cling/logging/Slf4jConfiguration.java
* Level
*/
enum Level {
TRACE,

@gnodet-bot gnodet-bot Oct 16, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Adding TRACE here requires updating all Slf4jConfiguration implementations. MavenSimpleConfiguration is updated ✅ but LogbackConfiguration and Log4j2Configuration both use default -> ERROR — Level.TRACE will silently map to ERROR on those backends.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet gnodet mentioned this pull request Oct 26, 2026
refactor: migrate internal plumbing DEBUG statements to TRACE level gnodet/maven#125
Open
1 task
@gnodet
gnodet marked this pull request as draft November 10, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@gnodet-bot gnodet-bot gnodet-bot requested changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

maintenance mvn4

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gnodet @gnodet-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.