How to configure Loggers for Jenkins Agents

Article ID:360057406531
1 minute readKnowledge base

Issue

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

Resolution

Since Remoting 3.8, Agent logging can be customized via property file (e.g. logging.properties) and its default behavior depends on the Work Directory mode (Before this release you have to use the -agentLog option or to redirect STDOUT/STDERR streams.)

Steps

1/ In the Remoting Working Directory locate a file called logging.properties with the following content.

# -Djava.util.logging.config.file=logging.properties .level = ALL handlers= java.util.logging.FileHandler java.util.logging.FileHandler.level=ALL java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.FileHandler.pattern=support/jenkins-ssh-agent-%u.log java.util.logging.FileHandler.limit=10000000 java.util.logging.FileHandler.count=10 javax.jms.connection.level=INFO hudson.level=INFO hudson.remoting.Channel.level=FINE hudson.remoting.FileSystemJarCache.level=INFO hudson.remoting.jnlp.level=FINE hudson.remoting.RemoteClassLoader.level=INFO jenkins.slaves.level=FINE hudson.slaves.level=FINE org.jenkinsci.remoting.engine.level=FINE jenkins.AgentProtocol.level=FINE

2/ Include -Djava.util.logging.config.file=<path to logging.properties> to Java Parameters options of the agent (Note the path from the Working Directory). Alternatively, it can be configured via adding -loggingConfig=<path to logging.properties> to the start up commands.

3/ Logs files will be available from ${workDir}/support