Need to Remove Log File Warning in Selenium

2019-06-10 22:33发布

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.

2条回答
狗以群分
2楼-- · 2019-06-10 23:02

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");
查看更多
一纸荒年 Trace。
3楼-- · 2019-06-10 23:15

Please include the following snippet to your code:

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

Hope this helps!

查看更多
登录 后发表回答