Nathaniel Waisbrot
Nathaniel Waisbrot

Reputation: 24523

Jenkins slave running Maven gives log4j warning

I'm using Jenkins, and I have a Windows machine set up as a slave worker. I have a Maven-based project that runs on the slave. The build works correctly, but I get a warning from log4j about it not being initialized. I'd like to scratch that itch and remove the warning, but I don't know how.

I'm not very familiar with log4j. I do understand I could set a system property to tell it where to find a config file, but I don't know where in the Jenkins pipeline that property should be set or how. It looks like the warning comes before Maven starts but after the slave begins the job.

Here's the snippit of console output:

Parsing POMs
[MyTest] $ java -cp C:\jenkins\maven3-agent.jar;C:\jenkins\tools\Maven\Maven\boot\plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main C:\jenkins\tools\Maven\Maven C:\Users\waisbrot\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\28\5c50da9c-2d1a9aef C:\jenkins\maven3-interceptor.jar 49210
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven:  -B -f C:\jenkins\workspace\MyTest\pom.xml test
[INFO] Scanning for projects...

Upvotes: 1

Views: 3810

Answers (2)

Wes
Wes

Reputation: 126

I'm not particularly proud of this, but I wasn't interested in any of that idle chatter, so I suppressed it by doing

jar uf <path to maven3-agent-1.2.jar>/maven3-agent-1.2.jar log4j.xml

where log4j.xml contains

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <root>
    <level value="off"/>
  </root>
</log4j:configuration>

NB: the jar command must be executed as shown, with log4j.xml in the current directory.

Upvotes: 1

Jens Schauder
Jens Schauder

Reputation: 81988

Just provide a log4j.properties or a log4j.xml with valid contents in the classpath. See the log4j documentation for details

Upvotes: 0

Related Questions