[logback-user] Logging and test coverage
Lukas Zapletal
lzap at seznam.cz
Wed Feb 25 16:51:35 CET 2009
To modify code coverage software to handle this situation?
LZ
Joern Huxhorn-2 wrote:
>
> Hi everybody.
>
> I was wondering if somebody has found a solution for the problem that
> logging - in general, not just using Logback - lowers the coverage of
> application code because code after
>
> if(logger.isDebugEnabled())
>
> is either executed or not, but not both, by the tests.
>
> It would be necessary to execute every test-method twice: once logging
> ALL and once logging OFF.
>
> Ignoring cases like that is not the solution because it can actually
> happen that a bug is enclosed or caused by such an if scope.
>
> It once happened that a variable was initialized inside of a larger
> if(logger.isDebugEnabled()) by mistake.
> This resulted in a behavior where everything worked until the logging
> level of that class was raised from DEBUG to INFO - which was a little
> bit nasty because everything would work again after lowering the level
> to DEBUG to look what's wrong... :p
>
> Does anyone have a good idea (or even a solution) how to tackle that
> problem?
>
> Regards, Joern.
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>
>
-----
--
Lukas Zapletal
http://lukas.zapletalovi.com
--
View this message in context: http://www.nabble.com/Logging-and-test-coverage-tp21974373p22205571.html
Sent from the Logback User mailing list archive at Nabble.com.
More information about the Logback-user
mailing list