[infinispan-dev] logger and ineritance

Mircea Markus mircea.markus at jboss.com
Mon Dec 19 07:33:03 EST 2011


On 19 Dec 2011, at 12:17, Galder Zamarreño wrote:

> 
> On Dec 16, 2011, at 4:57 PM, Mircea Markus wrote:
> 
>> Re: your first point here: http://bit.ly/tl2q14
>> 
>> With this approach not only that  an additional method call is added (hardly a big performance fault, but still..) but for me it makes it harder to compare the logs with the code, as the class that contains the code might be different than the class that "runs" the code. 
> 
> There are situations where this is handy such as https://github.com/infinispan/infinispan/pull/729. Here we have two versions of the protocol, version 1.0 and 1.1.
> 
> 1.1 is almost identical to 1.0, the changes are primarily around the hash distribution headers. The rest is the same.
> 
> Assumming you have two classes, Code10 and Codec11 and Codec11 delegates to Codec10 for the majority of work, the logs will show a mix of messages from Codec10 and Codec11 which seems a bit confusing, particularly if you're not familiar with the code.
> 
> By making Codec10 log with the logger of Codec11 when version 1.1 is in use, I agree that you see log messages that don't come from Codec11, but you get a clearer sense of which codec is in use, whether 1.0 or 1.1.
Indeed in your case it makes more sense to use logger as both Codec10 and Codec11 are there at runtime.  


More information about the infinispan-dev mailing list