Skip to content

Add additional debug logging to onNotifyCommit#3929

Open
MarkRx wants to merge 1 commit intojenkinsci:masterfrom
MarkRx:feature/notify-commit-additional-logging
Open

Add additional debug logging to onNotifyCommit#3929
MarkRx wants to merge 1 commit intojenkinsci:masterfrom
MarkRx:feature/notify-commit-additional-logging

Conversation

@MarkRx
Copy link

@MarkRx MarkRx commented Feb 13, 2026

Adds additional FINER and FINEST logging to git onNotifyCommit to assist with debugging - #3910

Testing done

Set hudson.plugins.git logger to ALL level. Increased log size with startup parameter -Dhudson.util.RingBufferLogHandler.defaultSize=16384

Setup a Jenkins job with polling enabled and a branch specified.

  1. Matching repository and branch
Feb 13, 2026 3:13:26 PM FINE hudson.plugins.git.GitStatus
Received notification from 1.2.3.4 ⇒ https://jenkins.company.com/git/notifyCommit for uri = ssh://git@code.company.com/myproject/myrepo ; sha1 = b1f0ab0e47b56c8ebd4671faf54445781d56128e ; branches = [mybranch]
Feb 13, 2026 3:13:26 PM FINEST hudson.plugins.git.GitStatus
Comparing notified uri ssh://git@code.company.com/myproject/myrepo against repository uri ssh://git@code.company.com/myproject/differentrepo.git in project myfolder » bootcamps » bootcamp_examples » feature/my-feature
Feb 13, 2026 3:13:26 PM FINER hudson.plugins.git.GitStatus
No matching repository uri for notified uri ssh://git@code.company.com/myproject/myrepo in project myfolder » bootcamps » bootcamp_examples » feature/my-feature
. . .
Feb 13, 2026 3:13:26 PM FINEST hudson.plugins.git.GitStatus
Comparing notified uri ssh://git@code.company.com/myproject/myrepo against repository uri ssh://git@code.company.com/myproject/myrepo.git in project myfolder » users » myuser » myjob
Feb 13, 2026 3:13:26 PM FINER hudson.plugins.git.GitStatus
Repository uri ssh://git@code.company.com/myproject/myrepo.git matches notified uri ssh://git@code.company.com/myproject/myrepo in project myfolder » users » myuser » myjob
Feb 13, 2026 3:13:26 PM FINEST hudson.plugins.git.GitStatus
Comparing modified branches [mybranch] against branch mybranch in project myfolder » users » myuser » myjob
Feb 13, 2026 3:13:26 PM FINE hudson.plugins.git.GitStatus
Branch Spec mybranch matches modified branch mybranch for myfolder » users » myuser » myjob
Feb 13, 2026 3:13:26 PM INFO hudson.plugins.git.GitStatus$JenkinsAbstractProjectListener onNotifyCommit
Scheduling myfolder » users » myuser » myjob to build commit b1f0ab0e47b56c8ebd4671faf54445781d56128e
Feb 13, 2026 3:12:43 PM FINER hudson.plugins.git.GitStatus
Processed notification from 1.2.3.4 ⇒ https://jenkins.company.com/git/notifyCommit for uri = ssh://git@code.company.com/myproject/myrepo ; sha1 = b1f0ab0e47b56c8ebd4671faf54445781d56128e ; branches = [mybranch] in 59 ms
  1. Ignore git notification setting
Feb 13, 2026 3:17:14 PM FINER hudson.plugins.git.GitStatus
Ignoring notified uri ssh://git@code.company.com/myproject/myrepo match in project myfolder » users » myuser » myjob due to ignore notify commit setting
  1. Matching repository but no matching branch
Feb 13, 2026 3:19:06 PM FINEST hudson.plugins.git.GitStatus
Comparing modified branches [nomatchbranch] against branch mybranch in project myfolder » users » myuser » myjob
Feb 13, 2026 3:19:06 PM FINER hudson.plugins.git.GitStatus
No matching branch spec for modified branches [nomatchbranch] in project myfolder » users » myuser » myjob

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@MarkRx MarkRx requested a review from a team as a code owner February 13, 2026 20:27
@MarkEWaite MarkEWaite added the rfe Improvement or new feature label Feb 16, 2026
@MarkEWaite MarkEWaite requested a review from Copilot March 21, 2026 12:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds more detailed debug logging to GitStatus.JenkinsAbstractProjectListener#onNotifyCommit to help troubleshoot why notifyCommit events do (or do not) trigger builds in Jenkins jobs.

Changes:

  • Adds FINER/FINEST logs while comparing the notified URI against configured repository URIs and while checking branch specs.
  • Adds FINER logs explaining why a potential match was skipped (no repo match, ignore-notify enabled, no branch match).
  • Adds FINER timing log summarizing notification processing duration.
Comments suppressed due to low confidence (1)

src/main/java/hudson/plugins/git/GitStatus.java:368

  • The debug log prints the repository URI using URIish.toString(). URIish can include userinfo (and potentially a password/token), so logging toString() risks leaking credentials when FINER/FINEST logging is enabled. Prefer logging uri.toPrivateString() (and similarly for any other URIish values in this method) to redact sensitive parts while keeping the URI useful for debugging.
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.log(Level.FINE, "Received notification from {0} for uri = {1} ; sha1 = {2} ; branches = {3}",
                           new Object[]{StringUtils.defaultIfBlank(origin, "?"), uri, sha1, Arrays.toString(branches)});
            }

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

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

Labels

rfe Improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants