logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luke Blanshard <l...@quiq.com>
Subject Re: Configuration in stateless objects?
Date Thu, 11 Jan 2001 00:38:27 GMT
Kirk Benson wrote:

> ...  I think the right way to do this
> is to define a subclass of Category (similar to MyCategory) and implement a
> static block within this class to configure the system.  As long as all
> logging uses this derived Category subclass, then the first call to
> getInstance() will configure the system.
> Is there a better way to do this?

Another way is to have a class with static fields that hold your variables,
and put the startup logic in that class's initializer.  For example, we have a
class called DebugControl that contains statements like:

    public static final Category keyword = Category.getInstance( "keyword" );

All our logging code looks like this:

    DebugControl.keyword.debug( "something happened" );


View raw message