Skip to main content
How do I create a logger for troubleshooting and debugging purposes in Jenkins? Jenkins provides multiple ways to collect more detailed logs when troubleshooting. Be careful: raising log levels for packages can produce large volumes of output and impact controller performance (increased I/O). Enable verbose logging only temporarily while diagnosing an issue, then restore or remove the logger.
Increasing log verbosity (e.g., to FINE, FINER, FINEST or ALL) can significantly impact Jenkins controller performance. Enable verbose logging only to diagnose issues, then restore the original level or delete the recorder.
A screenshot of a documentation webpage about configuring loggers for Jenkins, showing a "Resolution" heading. It includes a red "Warning" box about changing log levels and the start of a numbered "Solution 1" steps list, with browser tabs visible at the top.
Overview of options
  • Add a log recorder from the Jenkins UI — recommended for short-lived debugging.
  • Run a Groovy init script to set logger levels at startup.
  • Provide a Java logging properties file on the filesystem ($JENKINS_HOME/logging.properties).
  • Add a persistent log recorder definition XML under Jenkins home (survives restarts).
  • Configure default levels from the UI (note: UI changes may not persist across restarts).
Use the method that best fits your environment and operational constraints. Options summary Detailed examples Groovy init script
  • Add a Groovy script to the Jenkins initialization scripts (for example, in init.groovy.d/) to set logger levels programmatically. This is useful for automated deployments or containers where you control the image contents.
Logging properties (via filesystem)
  • You can also set logging via a Java logging properties file placed under $JENKINS_HOME/logging.properties and have Jenkins load it during startup:
Filesystem layout example
  • Example layout for a custom log recorder and its output file placed inside JENKINS_HOME/log/:
Persistent log recorder XML
  • To persist a named recorder across restarts, create an XML file under the Jenkins home logs directory. A minimal example (truncated):
UI approach (recommended for short-lived debugging)
  • The simplest and most approachable method for temporary troubleshooting is using the Jenkins UI:
  1. Manage Jenkins → System Log.
  2. Click “Add recorder” to create a named log recorder.
  3. Within the recorder, add one or more logger names (packages/classes) and set the desired level.
  4. Save, run the operation you want to diagnose, then view the recorded logs.
Use-case: Kubernetes cloud plugin debugging
  • Example scenario: a Kubernetes cloud configured in Jenkins fails the test connection and shows only a terse error in the UI. Creating a log recorder for the Kubernetes client packages (for example io.fabric8.kubernetes) reveals HTTP-level details, Authorization headers, and response bodies that the plugin UI hides.
A dark-themed Jenkins "Configure" page for a Kubernetes cloud named "dasher-prod-k8s-us-east," showing fields like Kubernetes URL, namespace (jenkins), and certificate key. The screenshot also shows the "Disable https certificate check" option enabled and a blue Save button.
If the test connection fails, the UI might show a high-level error such as:
To capture HTTP request/response and more detailed client logs:
  1. Manage Jenkins → System Log → Add recorder.
  2. Name it (for example k8s-logs).
  3. Add loggers such as io.fabric8.kubernetes and set the level to the desired verbosity (FINE, FINER, FINEST, or ALL). Use high verbosity only temporarily.
A screenshot of the Jenkins "Configure log recorder" settings page showing a log recorder named "k8s-logs." The log level dropdown is open with options like ALL, FINEST, FINER, FINE, and a warning about verbose levels hurting performance.
Search for the relevant package (e.g., “Kubernetes” or “io.fabric8”), select the appropriate logger and level, then Save.
A screenshot of the Jenkins "Configure log recorder" page showing a recorder named "k8s-logs" with a Logger input and a dropdown of io.fabric8.kubernetes.* logger options. The page includes a warning about verbose logging and a Save button.
After enabling the recorder, trigger the failing operation (for example, test connection). The log recorder will show verbose HTTP request/response traces from the fabric8 Kubernetes client. Example: 403 Forbidden (when RBAC prevents listing pods)
  • With verbose logging enabled you will see the HTTP request with the Authorization header and the server response, including the JSON response body returned by Kubernetes:
This JSON body ({"kind":"Status", ... }) is the raw Kubernetes response and is not normally visible in the plugin UI; the log recorder reveals it and helps identify RBAC or credential issues. Example: 200 OK (when credentials/permissions are correct)
  • When the connection succeeds, you’ll see similar HTTP-level logs followed by the Kubernetes version JSON in the response body:
Viewing and managing recorders
  • You can create multiple recorders for different plugins or packages and view their output from Manage Jenkins → System Log. Use separate recorders for different subsystems (for example, k8s-logs, git-logs, security-logs) to keep output organized.
Screenshot of the Jenkins web UI (dark theme) showing the "Log Recorders" page with entries "All Jenkins Logs" and "k8s-logs." The top bar includes breadcrumbs and buttons for "Add recorder" and "Log levels."
Cleanup
  • After troubleshooting, clear or delete the log recorder or restore previous log levels to avoid ongoing verbose logging and the associated performance impact.
Best practice: apply verbose logging only for the narrowest scope (specific package/class names), run the failing operation to capture the needed information, then revert changes immediately. Automate cleanup where possible (e.g., delete recorder via script or remove init scripts).
Links and references That covers configuring log recorders and other common approaches to increase logging for troubleshooting in Jenkins.

Watch Video