谢谢你抽出时间,
和
每个cucumberJVM场景都有自己的日志?
我当前的log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<File name="file" fileName="app.log">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
</PatternLayout>
</File>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="trace">
<AppenderRef ref="file" level="DEBUG"/>
<AppenderRef ref="STDOUT" level="INFO"/>
</Root>
</Loggers>
</Configuration>
package supportFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
public class LoggingFactory {
public static Logger Log = LogManager.getLogger();
public void debug(String message) {
Log.debug("DEBUG: " + message);
}
public void info(String message) {
Log.debug("INFO: " + message);
}
public void warn(String message) {
Log.debug("WARNING: " + message);
}
public void error(String message) {
Log.debug("ERROR: " + message);
}
public void fatal(String message) {
Log.debug("FATAL: " + message);
}
}
TestRunner.scenario = scenario;
System.out.println("Scenario: " + scenario.getId());
这将返回功能和场景名称,只需在最后添加一个.log,每次测试运行都会非常棒
在此非常感谢您的指导。