GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Logging foundation: structured LogEvent, JUL handler, Log API enhancements by gnodet · Pull Request #12694 · apache/maven Conversation
|
| Console mode | needsFormattedMessage |
needsMetadata |
Effect |
|---|---|---|---|
| Plain/Rich | true |
false |
No StackWalker, no SourceMetadata allocation |
| Machine (JSON) | false |
true |
No formatting (timestamp, ANSI, logger name) |
| + Build report | inherited | true (auto) |
setReportCapture() enables metadata |
Shared formatting — MavenBaseLogger.formatLogPrefix() is extracted so both the SLF4J call chain and logDirect() share the same formatting logic (timestamp, thread, ANSI level prefix, logger name).
Re-entrancy protection — IN_PUBLISH ThreadLocal guard in MavenJulHandler + catch in JLineMessageBuilderFactory.MavenStyleResolver handle the JLine → JUL → SLF4J → JLine bootstrap cycle. MavenJulHandler.LOGGER_CACHE uses putIfAbsent instead of computeIfAbsent to avoid ConcurrentHashMap reentrancy.
The following changes are in the forward-port commit and are not duplicated in this PR's diff:
Log.trace() — default no-op methods preventing AbstractMethodErrorLog.child(name) — hierarchical sub-loggersmaven.mojo.id) — fork-aware save/restoreDefaultLog warn bug fix + isXxxEnabled() guardsDefaultLogTest — 6 tests (warn regression, metadata lifecycle, trace delegation, trace no-op, child logger, default trace backward compat)| # | PR | Feature |
|---|---|---|
| 0 | #12929 | Forward-port of 4.0.x Log API enhancements |
| 0b | #13542 | BuildInvocation API |
| 1 | This PR | Logging foundation |
| 2 | #12695 | Build report |
| 3 | #13180 | Console modes |
| 4 | #12698 | Warning mode + diagnostics |
| 5 | #12699 | mvnlog viewer |
| 6 | #12702 | Structured problems pipeline |
| 7 | #12714 | TRACE level migration |
maven-4.0.x (milestone 4.1.0)DefaultLogTest — warn/supplier regression, trace delegation, trace no-op, child logger, default trace backward compatMavenJulHandlerTest — parameterized JUL→SLF4J level mapping, FINEST→TRACE, CONFIG→INFO, reentrancy safetymvn test -pl impl/maven-core,impl/maven-logging — all tests pass🤖 Generated with Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
bae1db9 to
5a5af1e
Compare
Add a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file (target/build-reports/) at the end of every build. Part 2 of the #12572 split. Builds on the logging foundation from PR #12694 (LogEvent, LogLevel, LogEventSink). New API interfaces: - BuildReport: root report with metadata, modules, failures, problems - BuildStatus: SUCCESS/FAILURE/SKIPPED enum - ModuleReport: per-module results with mojo list - MojoReport: per-mojo execution with captured log events - FailureReport: exception details and stack traces Implementation: - BuildReportCollector: EventSpy that tracks lifecycle events and captures log output via LogEventSink, routing events to mojo/module/build-level buffers using thread-based tracking - BuildReportJsonWriter: zero-dependency JSON serializer - Atomic file writes with timestamped files and latest symlink - Thread-safe for parallel builds (-T) Co-Authored-By: Claude Opus 4.6 <[email protected]>
e64db31 to
de8044a
Compare
Add a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file (target/build-reports/) at the end of every build. Part 2 of the #12572 split. Builds on the logging foundation from PR #12694 (LogEvent, LogLevel, LogEventSink). New API interfaces: - BuildReport: root report with metadata, modules, failures, problems - BuildStatus: SUCCESS/FAILURE/SKIPPED enum - ModuleReport: per-module results with mojo list - MojoReport: per-mojo execution with captured log events - FailureReport: exception details and stack traces Implementation: - BuildReportCollector: EventSpy that tracks lifecycle events and captures log output via LogEventSink, routing events to mojo/module/build-level buffers using thread-based tracking - BuildReportJsonWriter: zero-dependency JSON serializer - Atomic file writes with timestamped files and latest symlink - Thread-safe for parallel builds (-T) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file (target/build-reports/) at the end of every build. Part 2 of the #12572 split. Builds on the logging foundation from PR #12694 (LogEvent, LogLevel, LogEventSink). New API interfaces: - BuildReport: root report with metadata, modules, failures, problems - BuildStatus: SUCCESS/FAILURE/SKIPPED enum - ModuleReport: per-module results with mojo list - MojoReport: per-mojo execution with captured log events - FailureReport: exception details and stack traces Implementation: - BuildReportCollector: EventSpy that tracks lifecycle events and captures log output via LogEventSink, routing events to mojo/module/build-level buffers using thread-based tracking - BuildReportJsonWriter: zero-dependency JSON serializer - Atomic file writes with timestamped files and latest symlink - Thread-safe for parallel builds (-T) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add a structured build report that captures per-module and per-mojo execution results, timing, log events, and failures as a JSON file (target/build-reports/) at the end of every build. Part 2 of the #12572 split. Builds on the logging foundation from PR #12694 (LogEvent, LogLevel, LogEventSink). New API interfaces: - BuildReport: root report with metadata, modules, failures, problems - BuildStatus: SUCCESS/FAILURE/SKIPPED enum - ModuleReport: per-module results with mojo list - MojoReport: per-mojo execution with captured log events - FailureReport: exception details and stack traces Implementation: - BuildReportCollector: EventSpy that tracks lifecycle events and captures log output via LogEventSink, routing events to mojo/module/build-level buffers using thread-based tracking - BuildReportJsonWriter: zero-dependency JSON serializer - Atomic file writes with timestamped files and latest symlink - Thread-safe for parallel builds (-T) Co-Authored-By: Claude Opus 4.6 <[email protected]>
8baa65a to
02ac855
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Well-designed foundational logging infrastructure. The structured LogEvent API, JUL handler, and Log API enhancements provide a solid base for the build report and console modes PRs. A few issues noted below.
Also noted:
warn(Supplier<String>, Throwable) calling logger.info() instead of logger.warn().getFullGoalName() to getImplementation() (FQCN) enables proper hierarchical SLF4J level configuration but is a behavioral change — worth mentioning in release notes for users who configured logging by short-form names.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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Really solid foundation — the three-path convergence (Log API / SLF4J / JUL) onto one structured LogEvent is clean, and preserving the LogRecord metadata the stock SLF4JBridgeHandler drops is a genuine improvement. Nice catch on the warn(Supplier, Throwable) → logger.info() bug.
A few things worth a look before this becomes the base of the 7-PR chain — one API-compat question, one fork-context correctness question, one perf note, and some small nits. Nothing structural.
On tests (echoing the earlier note): the two I'd most want are a regression test asserting warn(Supplier, Throwable) actually logs at WARN, and a table test for the JUL→SLF4J level mapping (esp. FINEST→TRACE and CONFIG→INFO). Given the ThreadLocal/StackWalker plumbing, those would lock down the easy-to-regress bits.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Well-designed logging infrastructure foundation with clean three-path convergence (Log API, JUL, SLF4J). The bug fix for warn(Supplier, Throwable) calling logger.info() is confirmed correct.
Findings:
[medium] sequenceNumber() javadoc/contract mismatch — LogEvent.sequenceNumber() javadoc says @return the sequence number, always non-negative but the default implementation returns -1. The sibling method threadId() correctly documents or -1 if unavailable in its @return tag. The sequenceNumber() javadoc should follow the same pattern for consistency.
[medium] Inconsistent formattedMessage format between JUL and SLF4J — When a LogSink is installed, JUL events' formattedMessage is built by formatForConsole() which produces a minimal [LEVEL] message string, while SLF4J events produce a full formatted string with timestamps, thread names, and logger names via MavenBaseLogger.innerHandleNormalizedLoggingCall(). The practical impact is limited since the clean message() field is available for consumers who need consistent content, but in SimpleBuildEventListener.projectLogMessage() which uses formattedMessage() for console output, JUL events will look noticeably different from SLF4J events.
[low] Log4j2/Logback backend removal — The removal of Log4j2Configuration, LogbackConfiguration, and the logback-classic dependency means Maven no longer supports these as alternative SLF4J backends. This is intentional for the Maven 4.x logging redesign, but warrants mention in release notes for users who embedded Maven with a custom logging backend.
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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Well-architected logging foundation PR. Clean design with proper ThreadLocal management, volatile concurrency handling, and good layering (API → impl → collector). A few items to address:
High severity:
API contract contradiction (LogEvent.java line 188): sequenceNumber() Javadoc says "@return the sequence number, always non-negative" but the default implementation returns -1. Compare with threadId() which correctly documents "or -1 if unavailable". This is a public API interface marked @Experimental/@since 4.1.0 — the Javadoc should match the actual contract.
No test coverage: 1000+ lines of foundational code across 22 files with zero test files. LogEvent/DefaultLogEvent, MavenJulHandler (249 lines), DefaultLog.withMetadata/trace/child, LogSink interface, ProjectBuildLogAppender structured event creation, and the mojo MDC lifecycle are all untested. The PR description mentions "580 tests pass" but these are all pre-existing tests.
Medium severity:
StackWalker overhead (DefaultLog.java line 649): withMetadata() calls StackWalker.walk() on every log call for enabled levels. While trace/debug are typically disabled and info/warn/error are low-volume, plugins logging many INFO/WARN messages will pay the 1-5μs per-call cost.
Logger name change (DefaultBuildPluginManager.java line 128): Logger name changed from getFullGoalName() (e.g., "compiler:compile") to getImplementation() (e.g., "org.apache.maven.plugins.compiler.CompilerMojo"). Intentional for proper hierarchical SLF4J configuration, but a user-visible behavior change that could break existing SLF4J level configurations.
Dead code for future PR (ProjectBuildLogAppender.java line 130): reportCapture volatile field and setter are infrastructure for PR #12695 (build report). Currently unused in this PR — consider adding a brief comment noting the intent.
Low severity:
setMojoId(null) is called before delegate.mojoSucceeded/mojoFailed callbacks, inconsistent with the forkSucceeded/forkFailed pattern where cleanup happens after the delegate.
The bug fix changing logger.info() to logger.warn() in warn(Supplier<String>, Throwable) is correct and important. 👍
The removal of Logback/Log4j2 support is a significant architectural decision — worth explicit mention in release notes since users plugging in alternative SLF4J backends will lose that ability.
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.
There was an error while loading. Please reload this page.
02ac855 to
812a842
Compare
Review feedback addressedAll 8 review comments from @gnodet and @ascheman have been addressed in the latest force-push. Summary of changes: Bug fixes
Design improvements
Tests added
All 6 downstream PRs (#12695, #12697, #12698, #12699, #12702, #12714) have been rebased onto the updated commit. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
812a842 to
84568d2
Compare
Apply review fixes from #12694 to align the backport: - Log.java: make all 6 trace methods default (no-ops) to prevent AbstractMethodError for existing third-party Log implementors. isTraceEnabled() returns false by default. - ProjectBuildLogAppender: add FORKING_MOJO_ID ThreadLocal mirroring the existing FORKING_PROJECT_ID pattern. When setMojoId(null) is called, the forking mojo's ID is restored instead of clearing. - LoggingExecutionListener: save current mojoId in forkStarted(), clear forking mojoId in forkSucceeded/forkFailed. Fix cleanup ordering in mojoSucceeded/mojoFailed — delegate runs first, then MDC is cleared. Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Backport Log API enhancements and mojo MDC to 4.0.x
Backport four Log-related improvements from master to the 4.0.x branch
for inclusion in rc-7:
1. Log.trace() — new trace level (maps to SLF4J TRACE / JUL FINEST)
to separate Maven core internals from user-facing debug messages.
Currently -X floods debug output with resolver/interpolation details
that drown user-relevant diagnostics.
2. Log.child(name) — creates a sub-logger with an independently
filterable name (e.g. "CompilerMojo.diagnostics"), letting plugin
sub-components log under their own namespace.
3. Logger name alignment — Maven 4 Log now uses the mojo implementation
class name (e.g. "org.apache.maven.plugins.compiler.CompilerMojo")
instead of the goal name ("compiler:compile"). This matches what
Maven 3 mojos already use and enables standard SLF4J hierarchical
level configuration.
4. Mojo MDC propagation — sets "maven.mojo.id" (prefix:goal@executionId)
in the SLF4J MDC during mojo execution. All log messages — including
those arriving through the JUL-to-SLF4J bridge — now carry mojo
context, available to any SLF4J appender via %X{maven.mojo.id}.
Also fixes a pre-existing bug in DefaultLog where warn(Supplier, Throwable)
incorrectly delegated to logger.info() instead of logger.warn().
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Add isXxxEnabled() guards to Throwable-only log overloads
Align with master by wrapping the five xxx(Throwable) overloads
in level-enabled checks, avoiding unnecessary method calls and
empty string construction when the level is disabled.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Address review: default trace methods and fork-aware mojoId
Apply review fixes from #12694 to align the backport:
- Log.java: make all 6 trace methods default (no-ops) to prevent
AbstractMethodError for existing third-party Log implementors.
isTraceEnabled() returns false by default.
- ProjectBuildLogAppender: add FORKING_MOJO_ID ThreadLocal mirroring
the existing FORKING_PROJECT_ID pattern. When setMojoId(null) is
called, the forking mojo's ID is restored instead of clearing.
- LoggingExecutionListener: save current mojoId in forkStarted(),
clear forking mojoId in forkSucceeded/forkFailed. Fix cleanup
ordering in mojoSucceeded/mojoFailed — delegate runs first, then
MDC is cleared.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Address review: add DefaultLogTest and clear MDC on mojoSkipped
- Add DefaultLogTest with 5 tests: warn/supplier regression,
trace delegation, trace no-op guard, child() sub-logger,
and default trace methods (AbstractMethodError prevention).
- Clear mojo MDC in mojoSkipped() to prevent stale mojo context
from leaking into subsequent log messages.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of latest commits (abd26c76a9…5fc0e2ac90).
Previous CHANGES_REQUESTED finding (@param content / @param error tags missing in Log.java trace(Supplier) methods) is resolved — both methods carry full @param documentation in the current head.
Remaining commits address: LOGGER_CACHE unbounded-growth documentation, stale SLF4JBridgeHandler comment updates, missing requires java.logging in module-info.java. All correct.
LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ee2f7ea to
d45cb80
Compare
6930ef3 to
051e0ec
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on prior reviews — the two @param content/@param error tags on Log.trace(Supplier<String>) and Log.trace(Supplier<String>, Throwable) that were missing in SHA 6ccbc27a are now present. That CHANGES_REQUESTED finding is resolved.
One new finding introduced by this PR.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier review — the medium-severity finding (JUL root logger level leaking into the host JVM in embedded scenarios) is addressed.
Commit 8b0748d8 captures oldRootLoggerLevel = julRoot.getLevel() before the invocation and restores it via root.setLevel(level) in restoreRootLoggerHandlers(). The fix is correct: the root logger always has a non-null level (JUL initializes it from configuration, defaulting to INFO), and Logger.getLogger("") and LogManager.getLogManager().getLogger("") are the same instance per JUL spec, so the capture and restore operate on the same object that configureLogging() and activateLogging() modify.
No new issues found.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
8b0748d to
d70fcc0
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Clean implementation. Both low-severity observations raised during review are non-actionable: the @SuppressWarnings("deprecation") annotation for Thread.getId() is already present in the diff, and the child(name) blank-name guard targets pre-existing code not modified by this PR. No blocking issues.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d70fcc0 to
926fb30
Compare
57618c1 to
cae046c
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of commits d36408caa6 (merge: BuildEnvironment→BuildInvocation rename) and 7132ad5346 ("fix: drop BuildEnvironment – superseded by BuildInvocation from master").
Previous approval stands. All new changes from this rebase are correct:
@since 4.0.0 on setArtifactsUpdatePolicy/setMetadataUpdatePolicy — matches upstream/master (61afec0d10) where these methods were introduced with the same tag.token → selector / profileId bug fix in performProjectActivation and performProfileActivation — token was the loop variable, selector / profileId were the trimmed working copies; the charAt(0) == '+' check correctly targets the working copy. Matches master.artifactsUpdatePolicy/metadataUpdatePolicy propagation in MavenInvoker.populateRequest() — correctly forwards the new CLI options into the request.ApiRunner cleanup — buildEnvironment() stub removed (superseded by BuildInvocation from master), @SuppressWarnings("deprecation") correctly dropped.ApiRunner local repo path fix — branches 2 and 3 correctly use new LocalRepository(Path) instead of .toString() + new LocalRepository(String).One low-severity nit: branch 1 of the localRepository ternary still uses new LocalRepository(settings.getLocalRepository()) (the String constructor, which internally calls RepositoryUriUtils.toUri()) while branches 2 and 3 use the Path constructor directly. For full consistency and to avoid any URI-parsing edge case on paths with spaces, new LocalRepository(Path.of(settings.getLocalRepository())) would be cleaner — but settings.localRepository is always a plain filesystem path, so in practice this makes no difference.
This review was generated by an AI agent, Hermes on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
think the event API should be more log oriented and less a mix of precomputed data, wdyt?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for the review, Romain. Your inline comments have been addressed in the thread replies, but let me respond to the overall direction concern here. The
I agree with you on On the other comments:
I'll address these in the next commit. The overall shape of the API ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rmannibucau Thanks for the review — good design feedback. Addressed inline on each specific point. Summary of what I'll act on:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of commit 3541ca07 (merge from master: restore correct LocalRepository priority).
Previous findings: all addressed (confirmed in prior APPROVE of 2026-09-20).
New change (ApiRunner.java — LocalRepository priority):
LocalRepoProvider should always win.Path.toAbsolutePath() addition on the settings path is correct — settings.getLocalRepository() can be a relative path, and Path.of() alone keeps it relative.LocalRepository(String) uses File.getCanonicalFile() "which can follow a symlink". In practice RepositoryUriUtils.toUri() calls new File(path).toURI() which uses getAbsolutePath(), not getCanonicalPath(), so it does not resolve symlinks. The real motivation for bypassing the String constructor is to avoid RepositoryUriUtils URL-encoding the path. The comment is slightly misleading but the fix is correct.LGTM. The LocalRepository priority logic is now correct and the change is clean.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of commits f061e423 ("Address review: remove formattedMessage() from LogEvent API, add threadName() and throwable(), guard JUL setup against custom LogManager") and d591f4bb ("fix: spotless formatting on DefaultLogEvent convenience constructor").
Prior APPROVED findings (commit 3541ca07): all resolved — LocalRepository priority fix is correct.
New changes — two issues:
[critical] SimpleBuildEventListener.projectLogMessage() silently drops all log-level formatting — log(event.message()) outputs the raw substituted message without any [INFO]/[WARN]/[ERROR] prefix, timestamp, logger name, or ANSI styling. Before this commit, needsFormattedMessage defaulted to true and was never overridden, so MavenSimpleLogger produced a fully formatted line that flowed through as formattedMessage. Now needsFormattedMessage() is hardcoded to false and formattedMessage() is gone from the API — the structured data is in event.level() + event.message(), but SimpleBuildEventListener doesn't use it. All standard Maven terminal output will silently lose its prefix. Fix: reconstruct the formatted line from event.level() + event.message(), e.g. log("[" + event.level() + "] " + event.message()), or delegate to a LogEventFormatter.
[low] LogManager.getLogManager() called 7 times across 3 methods — invoke(), configureLogging(), and activateLogging() each repeat the LogManager.getLogManager() call rather than caching the result in a local variable. The idiomatic fix is a one-time LogManager logManager = LogManager.getLogManager(); at the top of each method (or a shared field), reducing 7 call sites to 1 per method.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of commits since the last APPROVE (2272eae465 / b0a1155e82, 2026-09-20).
All previously unresolved threads resolved in f274702c50:
✅ SimpleBuildEventListener.projectLogMessage() drops log-level prefix — fixed: now emits "[" + event.level() + "] " + event.message(), restoring the standard [INFO]/[WARN]/[ERROR] prefix that formattedMessage() previously provided.
✅ Redundant LogManager.getLogManager() calls — fixed: configureLogging() and activateLogging() now each cache LogManager.getLogManager() in a local logManager variable, eliminating the repeated singleton lookups.
New additions in f061e4238bd4 (since last APPROVE):
throwable() and threadName() default methods on LogEvent — well-designed defaults (null / null), implemented by DefaultLogEvent record components.LogManager guard throughout LookupInvoker (logManager.getClass() == LogManager.class) — correct defensive pattern for embedded-Maven scenarios (IDE plugins, app servers running custom LogManager implementations).restoreRootLoggerHandlers() now also restores the JUL root level — prevents level leak (e.g. SEVERE from quiet mode persisting after the invocation in embedded scenarios).One informational observation (not blocking): SimpleBuildEventListener now reconstructs the prefix as plain [INFO] etc., without ANSI styling. This is appropriate — SimpleBuildEventListener is the embedded/daemon-facing listener where the consumer (mvnd, IDE) is responsible for its own rendering. A comment to that effect would help future maintainers understand why ANSI is intentionally absent here, but this is a nit.
LGTM. No blocking issues.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier review — all CHANGES_REQUESTED findings are resolved.
Previous findings status:
Log.java — @param content tags restored on trace(Supplier<String>) and trace(Supplier<String>, Throwable)SimpleBuildEventListener.projectLogMessage() — log-level prefix "[" + event.level() + "] " correctly reconstructed from LogEvent (fixes raw message loss)LookupInvoker — LogManager.getLogManager() now cached in a local variable in both configureLogging() and activateLogging(), eliminating redundant singleton lookupsLOGGER_CACHE — Javadoc now explicitly documents the intentionally-unbounded design decisionThe two new commits (f6b30590, f274702c) are minimal and correct. The LogManager caching is a pure readability/performance improvement with no behavioral change (it's a JVM singleton). The SimpleBuildEventListener fix correctly reconstructs [INFO]-style prefixes from LogEvent.level() (enum name() matches Maven's bracket format). LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Following up on my earlier review — removed a false positive about raw type Consumer (the code already uses Consumer<String>, and that line isn't in this diff).
One design question on the level-prefix formatting remains (see inline comment).
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of commit a2103d5316 ("fix: output stack trace in SimpleBuildEventListener when LogEvent has throwable").
Fix is correct. The root-cause diagnosis (stack trace stored in LogEvent.stackTrace() but projectLogMessage() only emitting event.message()) is accurate, and the 4-line addition correctly restores stack trace output for MavenITmng5482AetherNotFoundTest.
One minor observation: formatStackTrace() uses t.printStackTrace(new PrintWriter(sw)) which produces a string ending with a trailing \n. SimpleBuildEventListener.log() delegates to output.accept(), wired in production to printWriter::println (which appends another \n). The result is an extra blank line after each stack trace — a cosmetic difference from pre-PR behavior where MavenSimpleLogger.writeThrowable() called the consumer line-by-line. Not a correctness issue, but worth noting if stack trace formatting is reviewed later.
No other issues. Prior APPROVED findings remain addressed.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…enhancements Structured LogEvent (maven-api-core, maven-core): - LogEvent / LogLevel API for structured log event representation - Source metadata: sourceClassName(), sourceMethodName(), threadId() - Execution context: projectId() and mojoId() Custom JUL Handler (maven-logging): - MavenJulHandler replaces SLF4JBridgeHandler — all JUL events route through SLF4J for consistent formatting regardless of origin - JUL metadata flows as method parameters via logDirect() instead of ThreadLocals - Re-entrancy guard for JLine StyleResolver → JUL → SLF4J bootstrap cycle Direct logging path (maven-logging, maven-core): - MavenSimpleLogger.logDirect() bypasses the SLF4J call chain for Log API and JUL events, carrying source metadata as parameters - MavenBaseLogger.formatLogPrefix() extracted as shared formatting logic - Eliminates ThreadLocal round-trips, lambda allocations, and SLF4J dispatch overhead for Maven-controlled logging paths Capability-driven optimization (maven-logging): - LogSink.needsFormattedMessage() — skip formatting when consumer uses structured fields (e.g. machine/JSON output mode) - LogSink.needsMetadata() — skip StackWalker and SourceMetadata allocation when consumer doesn't read source info (plain/rich console modes) - ProjectBuildLogAppender wires flags: metadata auto-enabled when reportCapture is active Structured LogSink (maven-logging, maven-core): - MavenSimpleLogger.LogSink replaces Consumer<String> with structured callback including level, logger name, clean message, and metadata - ProjectBuildLogAppender produces LogEvent objects with source metadata - BuildEventListener.projectLogMessage() now takes LogEvent Log API metadata (maven-core): - DefaultLog resolves caller class/method via StackWalker, gated behind LogSink.needsMetadata() for zero overhead in plain/rich console modes Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
a2103d5 to
a38c86d
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re-review of squash commit a38c86d4 ("feat: logging foundation", 2026-10-23T11:59).
All four points raised by @rmannibucau in the CHANGES_REQUESTED review are confirmed addressed:
throwable() in LogEvent — ✅ Added as a @Nullable default Throwable throwable() method on the LogEvent interface, populated from LogRecord.getThrown() on the JUL path. DefaultLogEvent carries it as a record component. The pre-formatted stackTrace() string is retained for consumers that can't handle live Throwable references.
formattedMessage() removed from the API — ✅ Removed. SimpleBuildEventListener now reconstructs the display string from structured fields: "[" + renderLevel(event.level()) + "] " + event.message(). The rendering concern is no longer in the LogEvent interface.
Thread name captured at event creation time — ✅ threadName() added as a default method on LogEvent and as a record component in DefaultLogEvent. Both capture paths (ProjectBuildLogAppender and MavenJulHandler) call Thread.currentThread().getName() at publish time, avoiding the fragile post-hoc reconstruction from thread ID.
LogManager guard for embedded-Maven scenarios — ✅ LookupInvoker checks LogManager.getLogManager().getClass() == LogManager.class before installing MavenJulHandler or modifying JUL root handlers/levels. The restoreRootLoggerHandlers path returns early (no-op) when handlers.length == 0 && level == null, i.e. when the custom-LogManager branch was taken. The guard pattern matches SLF4JBridgeHandler's own defense.
All prior APPROVED findings remain addressed. No new issues.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.