
Hi Patrick,
Sifting appender could probably help. Here is a sample config file:
public class MyTest { Logger logger = LoggerFactory.getLogger(Foo.class); @Before public void setUp() { MDC.put("testname", "myTest"); } @Test a() { logger.info("a says hello"); ... } @Test b() { logger.info("b says hello"); ... } } public class MyOtherTest { Logger logger = LoggerFactory.getLogger(Foo.class); @Before public void setUp() { MDC.put("testname", "MyOtherTest"); } @Test x() { logger.info("a says hello"); ... } }
Let us know if it works... -- Ceki
Hi Ceki, It works except for the delete. When I call the test (class) MyTest (multiple times) logback don't delete the log file but append it. The first time when the Logger initialize the file is truncated but not for the second and more times until the Logger must initialize again. -Patrick