There are different ways of configuring the logging level of Jenkins loggers. This article describe some of them.
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
hudson.plugins.git.GitStatus to the SEVERE level:
import java.util.logging.Level import java.util.logging.Logger Logger.getLogger("hudson.plugins.git.GitStatus").setLevel(Level.SEVERE) Logger.getLogger("hudson.security.csrf.CrumbFilter").setLevel(Level.SEVERE)
Create a file
logging.properties 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>/logging.properties. 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.level=INFO java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter hudson.security.csrf.CrumbFilter.level = 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)
You can set the logging level of the Loggers under. 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.
(Note: This solution does not survive a restart)
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
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.
For more information about Jenkins logging and loggers, please have a look at the following articles: