Trustin Lee ha scritto:
> On 5/31/07, peter royal <[EMAIL PROTECTED]> wrote:
>> from reading that, sounds like we should remove 'static' from all
>> loggers?
> 
> It is recommended to do so, but certain classes that is created very
> often could be excluded to avoid excessive memory consumption.

I often use dependency injection to inject loggers in child classes in
this cases instead of using static loggers.
The factory/parent of the objects created too often creates a logger for
them and pass it to them as an argument.

I also add a getLogger that check if "logger" is not null, otherwise
creates its own logger. This way I'm sure that if no one inject the
logger I don't throw an NPE.

Stefano

Reply via email to