Skip to content

[JENKINS-75310] Fix log recorder level updates - #27065

Open
U-S-jun wants to merge 5 commits into
jenkinsci:masterfrom
U-S-jun:fix/jenkins-75310-log-recorder-level
Open

[JENKINS-75310] Fix log recorder level updates#27065
U-S-jun wants to merge 5 commits into
jenkinsci:masterfrom
U-S-jun:fix/jenkins-75310-log-recorder-level

Conversation

@U-S-jun

@U-S-jun U-S-jun commented Jul 10, 2026

Copy link
Copy Markdown

Fixes #16660

When a custom log recorder target was changed from a more verbose level to a less verbose level, Target.enable() left the old explicit controller logger level in place. The new level was already loggable at the old setting, so the controller skipped the update even though the recorder configuration had changed.

Keep the pre-submit targets long enough to identify these less-verbose changes. After the normal save, clear an explicit level only when it still matches the old recorder target, then reapply active same-name and descendant targets using the existing conditional behavior. This preserves overlapping recorder requirements and manual or inherited hierarchy levels. Agent broadcasts remain unchanged.

Testing done

  • Confirmed the new form-driven regression tests fail against the unmodified core because FINEST remains installed after selecting a less verbose level.
  • mvn -pl test -am -Dtest=hudson.logging.LogRecorderManagerTest -Dsurefire.failIfNoSpecifiedTests=false test (11 tests, 0 failures or errors)
  • mvn -pl core spotless:check

Screenshots (UI changes only)

No UI changes.

Before

N/A

After

N/A

Proposed changelog entries

  • Apply less verbose custom log recorder levels without retaining stale controller logger state.

Proposed changelog category

/label bug

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

N/A

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

Copilot AI review requested due to automatic review settings July 10, 2026 07:57
@comment-ops-bot comment-ops-bot Bot added the bug For changelog: Minor bug. Will be listed after features label Jul 10, 2026
@welcome

welcome Bot commented Jul 10, 2026

Copy link
Copy Markdown

Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!

A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an inconsistency where lowering a custom log recorder target’s verbosity (e.g., FINESTINFO) could leave a stale explicit controller Logger level in place, causing Logger#getLevel() / isLoggable to disagree with the intended recorder configuration. The change introduces targeted controller-side level reconciliation after config submissions and adds regression tests covering shared/descendant/manual-level interactions.

Changes:

  • Refactors LogRecorder.Target#enable() to split controller-side conditional updates (enableLogger) from agent broadcasts.
  • Adds LogRecorder#updateLogLevels(...) to clear stale explicit controller levels (when still matching the old recorder target) and reapply same-name/descendant targets in a safe order.
  • Adds new JUnit regression tests for less-verbose updates, shared targets, descendants, and manual intermediate levels.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
core/src/main/java/hudson/logging/LogRecorder.java Adds controller-side reconciliation logic for less-verbose target changes and refactors enable behavior to support it.
test/src/test/java/hudson/logging/LogRecorderManagerTest.java Adds form-driven regression tests ensuring logger state updates correctly when recorder targets become less verbose, including overlap/descendant cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@U-S-jun
U-S-jun marked this pull request as ready for review July 10, 2026 17:08
Copilot AI review requested due to automatic review settings July 10, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread core/src/main/java/hudson/logging/LogRecorder.java
Copilot AI review requested due to automatic review settings July 10, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@MarkEWaite MarkEWaite added pct-successful This PR has successfully passed the full plugin-compatibility-test suite ath-successful This PR has successfully passed the full acceptance-test-harness suite labels Jul 15, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread core/src/main/java/hudson/logging/LogRecorder.java
Copilot AI review requested due to automatic review settings July 26, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@U-S-jun

U-S-jun commented Jul 26, 2026

Copy link
Copy Markdown
Author

Hi @jenkinsci/core-pr-reviewers, this PR has been ready for review since July 10. I’ve addressed and resolved all Copilot feedback in 481917d07c. Local validation passes (LogRecorderManagerTest: 13 tests, 0 failures/errors; Checkstyle; Spotless), and the previous full CI/ATH/PCT run was green. The latest CI is now running for this small follow-up. Could someone please take a look when available? Thank you!

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

Labels

ath-successful This PR has successfully passed the full acceptance-test-harness suite bug For changelog: Minor bug. Will be listed after features pct-successful This PR has successfully passed the full plugin-compatibility-test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-75310] Setting log level from bottom up in custom log recorders doesn't work correctly

3 participants