
On 18.11.2010 17:35, pwillems66@zonnet.nl wrote:
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.
It is not clear to me what you mean by "test". Is a test the class containing the various test methods or does "test" refer to each test method? For example, Given the MyTest class mention in my previous post, is MyTest the "test" or are the methods a() and b() "tests"? If the latter, you could try, public class MyTest { Logger logger = LoggerFactory.getLogger(MyTest.class); @Test a() { MDC.put("testname", "myTest_a"); logger.info("a says hello"); ... } @Test b() { MDC.put("testname", "myTest_b"); logger.info("b says hello"); ... } }
-Patrick