Jenkins Log Recorders

May 7th, 2018 Posted by Cloudbees, DevOps No Comment yet

My Jenkins job was set to trigger a build automatically from a simple GitHub webhook, but the job didn’t build when code changes were pushed to GitHub. Was the problem in Jenkins, GitHub, or something else? I investigated using Jenkins log recorders.

To eliminate GitHub as the possible obstacle, I added relevant loggers¹ to Jenkins’ default log recorders:

  • com.cloudbees.jenkins.GitHubWebHook
  • org.jenkinsci.plugins.github.webhook.*
  • org.jenkinsci.plugins.github.admin.GitHubHookRegisterProblemMonitor

¹ These loggers are listed in B.5 Dedicated Logger among the troubleshooting options in GitHub: Webhook Troubleshooting. (Note that the GitHub Plugin wiki page lists a slightly different set of loggers.)

The steps below outline the procedure.

  1. Open the Jenkins Log page (screenshot below): Jenkins home page > Manage Jenkins > System Log
    (Direct URL is like this: http://<jenkins-url>/log/)System Log page
  2. Click Add new log recorder. This opens a new form with a text field: enter a unique name like “GitHub Logs”, then click OK to open the form below.Log recorder
  3. Next to Loggers, click Add: enter a logger string and choose a level or leave the default (ALL). Repeat for the remaining loggers.
  4. Click Save.

Now any GitHub webhook invocations that point to this Jenkins should add entries to its Log page, as in the sample below.

 

 

These log entries confirm that the GitHub webhook works as expected for a repo at the URL specified in line 6, copied below:

 

 

Jenkins checks every job and triggers the ones matching this URL. The log shows that no job was triggered (all jobs were skipped), but the problem is not with my GitHub setup.

 

Summary

The log recorder framework is a powerful mechanism for digging into the behaviour of a plugin. If you need to know which loggers are available for a given plugin, start with the plugin documentation.

Tags: , , , ,

No comments yet. You should be kind and add one!

Leave a Reply