【问题标题】:Jenkins shows log4j complaining with: log4j:WARN No appenders could be found for logger [duplicate]Jenkins 显示 log4j 抱怨:log4j:WARN No appenders could be found for logger [重复]
【发布时间】:2015-03-01 06:11:51
【问题描述】:

谁能帮我弄清楚为什么 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.

...

【问题讨论】:

  • 它是重复的,问题不在于 IDE 或 Jenkins,而在于您的构建/代码。

标签: java selenium jenkins log4j


【解决方案1】:

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

【讨论】:

  • 我在 Eclipse 中尝试过,但它仍然给我错误。
  • 我最终通过转储 Ant 并使用 Maven 3 解决了这个问题。然后我将 log4j.properties 放入我的资源文件夹中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-18
  • 1970-01-01
  • 1970-01-01
  • 2015-01-31
  • 2023-04-03
相关资源
最近更新 更多