0

I have a scenario class, which has list of Test cases. Is there any way that I can save each Test case execution to separate file with name: TestCaseName.log?

I have done this before with java.util.logging by adding file handler in the code, but have no idea how to do this with Log4j.

4

2 回答 2

0

org.apache.log4j.RollingFileAppender您可以通过为每个测试用例类配置单独的来做到这一点。您可以查看链接http://logging.apache.org/log4j/2.x/manual/configuration.html进行配置。

于 2014-04-14T09:01:02.090 回答
0

通过以编程方式添加 RollingFileAppenders 来完成任务,就像在此示例中一样:http: //howtodoinjava.com/2013/04/08/how-to-programmatically-configure-appenders-in-log4j/

于 2014-04-23T10:29:07.287 回答