[hibernate-dev] Tests asserting warnings get logged

Hardy Ferentschik hardy at hibernate.org
Fri Mar 28 08:35:47 EDT 2014

On 28 Jan 2014, at 13:21, Sanne Grinovero <sanne at hibernate.org> wrote:

> On 28 March 2014 12:15, Hardy Ferentschik <hardy at hibernate.org> wrote:
>> On 28 Jan 2014, at 13:03, Sanne Grinovero <sanne at hibernate.org> wrote:
>>> I'd then remove Log4J from our test dependencies to primarily rely on
>>> assertions only;
>> Why would you do that? I would expect whatever solution we come up with to
>> just delegate to the underlying logger.
> Exactly, which doesn't need to be Log4J but could be our testable surrogate.

Except with log4j I already have a lot of built-in functionality which you would have 
to first build in your solution. For example, category configuration or the ability to
use different appenders.

>>> or for debugging purposes to have it forwards
>>> messages to System.out too - probably enabled by some environment
>>> option - would be good enough.
>> We have the logging system configurable already. Why complicating things.
>> All we would be after is a way to verify that a given log message gets called.
>> Everything else should behave as before.
> How so "complicating things"? I'm just suggesting to throw away a lot
> of unnecessary complexity

Which unnecessary complexity?

> and focus on the stuff that matters: assert for specific messages,

The ability to assert log messages is great and wanted, but the overall log
is important as well. I want to see that it actually works. And just looking at the log
every now and then helps me to understand what’s happening, detect potential typos,
find places where logging should be improved, ...

> which is something Log4J doesn't provide

Why would it, it is not a testing framework. 


More information about the hibernate-dev mailing list