[logback-user] Logging and test coverage

Joern Huxhorn jhuxhorn at googlemail.com
Wed Feb 25 19:06:00 CET 2009


Thorbjørn Ravn Andersen wrote:
> Joern Huxhorn skrev:
>> Does anyone have a good idea (or even a solution) how to tackle that
>> problem?  
> Use the log.whatever("foo {} bar {}", ...)  approach and avoid the if?

Lukas Zapletal wrote:
> To modify code coverage software to handle this situation?
>
> LZ

Hi guys,

neither suggestion would help in our situation.

We have a large code-base which contains

if(logger.isXxxEnabled()) logger.xxx(...);

Changing all loggings statements isn't an option.

Beside that, we also have code like
if(logger.isXxxEnabled())
{
// perform lots of preparation, construct large message using
StringBuilder etc.
   logger.xxx(builder.toString());
}

Code like that may actually contain a bug (and did so in the past) so I
*want* to run all tests, once with Level.ALL and once with Level.OFF.

I thought maybe someone has already found a solution but I should
probably ask that question on a junit mailinglist...

Thanks anyway,
Joern.


More information about the Logback-user mailing list