Jenkins 显示 log4j 抱怨:log4j:WARN No appenders could be found for logger

Jenkins shows log4j complaining with: log4j:WARN No appenders could be found for logger

有人可以帮我弄清楚为什么 Jenkins 在 IDE 运行时一直抱怨 log4j 吗?我熟悉该错误及其修复方法。我的 src 文件夹中有一个 log4j.properties 文件。当我从 IDE 运行测试时,我没有看到此错误。仅来自詹金斯。任何帮助将不胜感激。

这与我链接到的问题不同!请阅读问题!这发生在 Jenkins,而不是 IDE。

谢谢

堆栈:

Started by user anonymous
Building in workspace C:\Users\userm4\.jenkins\jobs\Company Smoke Test\workspace
[Selenium Main] $ cmd.exe /C '"C:\apache-ant-1.9.4\bin\ant.bat -file TestNG run makexsltreports && exit %%ERRORLEVEL%%"'
Buildfile: E:\Selenium Main\TestNG\build.xml

setClassPath:

init:

clean:
   [delete] Deleting directory E:\Selenium Main\TestNG\build

compile:
     [echo] making directory...
    [mkdir] Created dir: E:\Selenium Main\TestNG\build
     [echo] classpath------: E:\Selenium Main\TestNG\lib\SaxonLiaison.jar:E:\Selenium Main\TestNG\lib\jtds-1.3.1.jar:E:\Selenium Main\TestNG\lib\junit-4.11.jar:E:\Selenium Main\TestNG\lib\log4j-1.2.17.jar:E:\Selenium Main\TestNG\lib\mysql-connector-java-5.1.34.jar:E:\Selenium Main\TestNG\lib\saxon-8.7.jar:E:\Selenium Main\TestNG\lib\selenium-java-2.44.0.jar:E:\Selenium Main\TestNG\lib\selenium-server-standalone-2.44.0.jar:E:\Selenium Main\TestNG\lib\testng-6.8.8.jar
     [echo] compiling...
    [javac] E:\Selenium Main\TestNG\build.xml:66: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 52 source files to E:\Selenium Main\TestNG\build

run:
   [testng] [TestNG] Running:
   [testng]   E:\Selenium Main\TestNG\testng.xml
   [testng] 
   [testng] log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
   [testng] log4j:WARN Please initialize the log4j system properly.
   [testng] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

...

尝试在构建中将 log4j.properties 移动到 WEB-INF/classes 或在作业命令中添加 -Dlog4j.configuration=theconfig