Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Logs on the system

When running jenkins.war manually with java -jar jenkins.war, all logging information by default is output to standard out. Many Jenkins native packages modify this behavior to ensure logging information is output in a more conventional location for the platform.


For example, put the following Groovy script into a file called.jenkins/init.groovy.d/extralogging.groovy

Code Block

import java.util.logging.ConsoleHandler
import java.util.logging.FileHandler
import java.util.logging.SimpleFormatter
import java.util.logging.LogManager
import jenkins.model.Jenkins

// Log into the console
def WebAppMainLogger = LogManager.getLogManager().getLogger("hudson.WebAppMain")
WebAppMainLogger.addHandler (new ConsoleHandler())

// Log into a file
def RunLogger = LogManager.getLogManager().getLogger("hudson.model.Run")
def logsDir = new File(Jenkins.instance.rootDir, "logs")
FileHandler handler = new FileHandler(logsDir.absolutePath+"/hudson.model.Run-%g.log", 1024 * 1024, 10, true);
handler.setFormatter(new SimpleFormatter());


A much simpler solution (though with no configurability) is to install the Support Core pluginPlugin, which causes custom logs to be written to disk automatically.

Debug logging in Jenkins

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>/ In the file please add the below line:

Code Block