我收到两个控制台警告:
log4j:WARN No appenders could be found for logger (org.roussev.selenium4j.MainTestCase).
log4j:WARN Please initialize the log4j system properly.
以下是我的 log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="appender" class="org.apache.log4j.FileAppender">
<param name="File" value="selenium4j.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
</layout>
</appender>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
</layout>
</appender>
<root>
<priority value ="DEBUG"/>
<appender-ref ref="appender"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>
我不确定为什么会出现此错误。xml对我来说似乎很好。