Skip to main content
In this guide, we’ll show you how to create and manage loggers in Jenkins for effective troubleshooting and debugging. Jenkins offers multiple methods to adjust logging levels—ideal for diagnosing issues in plugins, pipelines, and integrations.
Increasing verbosity generates more log output and can impact controller performance due to higher disk and I/O usage. Only raise logging levels during active troubleshooting, and revert to defaults afterward.

Logging Configuration Options

You can configure custom logging in Jenkins using one of these five approaches:
  1. Add a Logger via the Jenkins UI (recommended)
  2. Initialize via a Groovy Script
  3. Use a Java Util Logging Properties File
  4. File System Custom Log Recorder
  5. XML Configuration via the UI (non-persistent)

1. Add a Logger via the Jenkins UI

For dynamic control over logging, the Jenkins UI is the easiest option. For example, to troubleshoot the Kubernetes cloud plugin:
  1. Go to Manage JenkinsSystem Log.
  2. Click Add new log recorder, provide a name, then add the package or logger and select the desired level.
The image is a screenshot of a webpage providing instructions on adding a logger from the UI in Jenkins, with a step-by-step guide and a partial view of the Jenkins interface.
Using the UI allows you to switch log levels at runtime without restarting Jenkins.

2. Initialize via a Groovy Script

Place a Groovy file under JENKINS_HOME/init.groovy.d/ to set log levels at startup:

3. Java Util Logging Properties File

Drop a logging.properties file into $JENKINS_HOME:

4. File System Custom Log Recorder

Create XML definitions under the Jenkins home directory:

5. XML Configuration via the UI (Non-Persistent)

You can also paste default logger settings directly in the UI (resets on restart):

Example: Debugging Kubernetes Cloud Connection

When testing your Kubernetes cloud in Jenkins, you might see a generic error:
A 403 Forbidden often indicates missing RBAC permissions for the Jenkins service account.
To capture HTTP-level details:
  1. Go to Manage JenkinsSystem Log.
  2. Click Add new log recorder, name it (e.g., k8s-logs), and set level to All.
  3. Search for Kubernetes and select io.fabric8.kubernetes.client or the specific subpackage.
The image shows a Jenkins configuration interface with a dropdown menu open, displaying various options like "Credentials" and "System Log." There is also an error message related to Kubernetes client execution visible in red text.
The image shows a Jenkins configuration screen for setting up a log recorder named "k8s-logs," with a dropdown menu for selecting log levels. A warning advises against setting the Root logger to "FINE" or below due to performance issues.
The image shows a Jenkins configuration screen for setting up a log recorder, with a dropdown menu displaying Kubernetes-related logger options.
After saving, retry the connection and then refresh the log recorder view to see detailed HTTP exchanges:
These entries reveal the full request headers, status codes, and JSON payload.

Example: Successful Connection

With correct RBAC and service account settings, the UI will show a one-line success. Jenkins will still record the detailed HTTP lifecycle if debug logging is enabled:
The image shows a configuration screen for Jenkins, specifically for setting up a Kubernetes cloud. It includes options for Kubernetes Namespace, Agent Docker Registry, and connection settings.
You can also log the Kubernetes version:

Cleanup

After you’ve resolved the issue, delete any custom log recorders or reset log levels to restore Jenkins’s default performance.

Watch Video