Skip to end of metadata
Go to start of metadata

This dialog lets you to tweak the logging level of java.util.logger.Logger in the server process. This is often useful for getting more information out of Jenkins for trouble-shooting.

In Java, loggers are identified by their names, such as "hudson.model.Project", which designates the name of the class where the logging message comes from. Loggers are also organized into a hierarchy in the same way classes are organized into packages, so "hudson.model" and "hudson" are the ancestor loggers for "hudson.model.Project".

Logging level is a property for individual logger, but most loggers are by default configured to inherit its logging level from the parent. This means that except the loggers where the logging levels are configured, you can affect the logging level of a whole package by simplying setting the logging level for that package.

Refer to Jenkins source code or the mailing list archive for what logger corresponds to what feature.

See Java Logging Overview for more about the java.util.logging package.

  • No labels

3 Comments

  1. There is a lack of information regarding on how to configure the log level of jenkins, at the instance level. Also the information regarding setting new loggers in the GUI, just doesn't work and is missing information regarding setting the logging level globally (like a * namespace).

  2. How can I make the logger configuration persistent? At this moment any jenkins restart will reset it.

  3. There are different ways of configuring the logging.

    Solution 1: use java.util.logging:

    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 set the level of hudson.security.csrf.CrumbFilter and hudson.plugins.git.GitStatus to SEVERE:

    $JENKINS_HOME/logging.properties
    .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

    (Note: For this solution I have not found a way to set the level for packages/classes that don't use java.util.logging but instead for example org.apache.commons.logging).

    Solution 2: 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 appropriately. For example, the following script does the same as above:

    $JENKINS_HOME/init.groovy.d/logging.groovy
    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)