[slf4j-dev] Better printing method signatures?

Niclas Hedhman niclas at hedhman.org
Tue Jun 28 06:11:53 CEST 2005


On Tuesday 28 June 2005 01:50, Ceki Gülcü wrote:
> At 06:53 AM 6/19/2005, Niclas Hedhman wrote:
> >The only negative thing about many methods that I can think of, is
> >unittesting
> >becomes slightly more 'tiring'. That made me think that we should perhaps
> >provide a "slf4j-unit.jar" which is SLF4J tailored for unittesting, which
> > is as light weight as possible, and maybe contain verification methods of
> > expected input.
>
> Testing? Why, that's my favorite topic. The tricky code is in the
> formatter which can be tested in a single TestCase class. The code in
> the printing methods look to me as being quite short and obvious, so I
> wouldn't bother unit testing those, at least not at the SLF4J
> level. But maybe I misunderstood the intent. Are you suggesting
> slf4j-unit.jar designed specifically for unit testing? How would that
> be different than say slf4j-simple.jar ?

To allow for validation of relevant log messages, I typically end up creating 
a dedicated TestLogger for each unittest, or a collection of unittests.
I am not so much interested in "seeing the message" but to have the tools 
verifying that it is correctly formatted.
(Of course this is not about debug statements, but for projects where we use 
Log4J to do audit trails, which have predefined and strict formatting rules)


> The venerable printf() method in the C language refers to its first
> argument as "format". In books, one talks about the "format string". 

Ok. I think it is not really a big thing, and your argument makes a lot of 
sense.


Cheers
Niclas



More information about the slf4j-dev mailing list