需要删除Selenium中的日志文件警告[英] Need to Remove Log File Warning in Selenium

本文是小编为大家收集整理的关于需要删除Selenium中的日志文件警告的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我在我的硒包中使用 log4j.properties .

每次我运行模块时,在控制台和applications.log文件中始终添加以下3行.

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

参考,以下是 log4j.properties 代码:

#Application Logs
log4j.logger.devpinoyLogger = DEBUG,dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.maxFileSize= 5000KB
log4j.appender.dest1.maxBackupIndex=3
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/YYYY HH:mm:ss} %m%n
log4j.appender.dest1.File=D:\\Automation\\src\\Logs\\Application.log
#do not append the old file .Create a new log File everytime
log4j.appender.dest1.Append=false

请让我知道要更改需要什么才能从控制台输出和应用程序日志中删除3行警告.

推荐答案

请在您的代码中包含以下片段:

System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");

希望这会有所帮助!

其他推荐答案

这将解决您的错误,并将消息显示在控制台中:

System.setProperty("org.apache.commons.logging.Log",
    "org.apache.commons.logging.impl.Jdk14Logger");

本文地址:https://www.itbaoku.cn/post/1574970.html

问题描述

I am using the log4j.properties in My Selenium Package.

Every Time I run the Module the below 3 Lines are always been added in the Console and the Applications.log file.

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

For Reference, below is the log4j.properties Code:

#Application Logs
log4j.logger.devpinoyLogger = DEBUG,dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.maxFileSize= 5000KB
log4j.appender.dest1.maxBackupIndex=3
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/YYYY HH:mm:ss} %m%n
log4j.appender.dest1.File=D:\\Automation\\src\\Logs\\Application.log
#do not append the old file .Create a new log File everytime
log4j.appender.dest1.Append=false

Please let me know what needs to be change in order to remove the 3 lines of Warnings from the console output and Application logs.

推荐答案

Please include the following snippet to your code:

System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");

Hope this helps!

其他推荐答案

This will resolve your errors and the message appears in the console:

System.setProperty("org.apache.commons.logging.Log",
    "org.apache.commons.logging.impl.Jdk14Logger");