tags:

views:

55

answers:

2

I am executing TestNG tests , and the logging output is set to DEBUG, so in case of a failure I can get to inspect exactly what goes wrong.

The problem is that the output is extremely verbose, and it's bothering everyone when it runs . I would like to capture all Log4J logging events - which is easy - and only print them when the test fails. Also, I need to take into account @Before/@After methods and also print output for them.

Assuming that I already have a List of Log4J LoggingEvents , how can I print those only when the Test/After/Before methods fail?

A: 

Implement and register a org.testng.ITestListener and react on the callback methods.

Robert Munteanu
+1  A: 

This site has a explanation on how to do it..

Sardathrion
Thanks, it's somehow related, but not what I'm looking for.
Robert Munteanu