Configure Loggers for Jenkins

Article ID:115002626172
2 minute readKnowledge base


  • I want to adjust the log levels in Jenkins for specific packages / classes


There are different ways of configuring the logging level of Jenkins loggers. This article describe some of them.

Solution 1: use a post initialization script:

Jenkins provides a way to run groovy script during initialization: Post-initialization script. So you can create a script that set the logging levels appropriately on startup. For example, the following script set the level of and hudson.plugins.git.GitStatus to the SEVERE level:

import java.util.logging.Level
import java.util.logging.Logger


Solution 2: use java.util.logging

Create a file in which you define the logging levels and a ConsoleHandler. Then pass this file to the JVM by adding the system property -Djava.util.logging.config.file=<pathTo>/ A file like the following would apply the same configuration as in Solution 1:

.level = INFO
handlers= java.util.logging.ConsoleHandler

java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter = SEVERE
hudson.plugins.git.GitStatus.level = SEVERE

See the Java Logging Overview for more details about this method.

(Note: This solution works for classes that use java.util.logging. For classes that use a different implementation - for example org.apache.commons.logging - the level will not be changed)

Solution 3: From the Jenkins UI

You can set the logging level of the Loggers under Manage Jenkins  System Logs  Log Levels. Simply copy/paste the logger or package you want to adjust the level for, select the logging Level and click on Submit. For example, the following matches the same configuration as in Solution 1.

jenkins log levels

(Note: This solution does not survive a restart)

Custom loggers, log levels and performance impact considerations

When changing a log level or creating a new custom logger, you should clearly understand the implications of such a change and the potential impact in the overall performance of your instance. By changing a log level from WARNING to ALL you might be changing the number of lines persisted to the logs in several orders of magnitude, and this can severely impact the performance of your instance and can even bring it to a point where it is not usable anymore.

There will be good reasons for you to increase the log levels for a given class or create a custom logger to further troubleshoot an elusive problem. Nevertheless, the general recommendation is that the change should not stay in the system, so after you enable that log level change or that custom logger, wait for some minutes (enough for the issue that you are looking for to happen an be logged) and right after get the log setting back to normal or remove the custom logger that you have created.

The information will be already persisted. You can generate a support bundle as explained here including custom loggers information. This will allow you to check the custom loggers files inside nodes/master/logs/custom folder. You can also go to your $JENKINS_HOME/logs/custom to get the same information if you have access to the instance file system to review these files.

Removing Custom Loggers

To remove a custom logger you have implemented, navigate to Manage Jenkins  System Logs to view your configured loggers.

Click on the cog/configure icon to adjust individual class loggers or delete the logger entirely.


For more information about Jenkins logging and loggers, please have a look at the following articles: