[slf4j-dev] is there anyone out there?
Niclas Hedhman
niclas at hedhman.org
Thu May 5 06:34:06 CEST 2005
On Thursday 05 May 2005 04:53, robert burrell donkin wrote:
> > Robert also mentioned the child logger management being part of the
> > application framework's concern space. I would like to highlight that it
> > is not desirable that the addChildLogger() is exposed in the Logger
> > interface, but through some other well-define management interface, to
> > avoid client abuse. This is perhaps not within the scope of this project.
>
> interesting :)
>
> requests for this kind of thing came along a number of times. could you
> expand a little (to make sure i understand correctly)?
I am mostly involved in IoC-styled component frameworks, and in such the
container will provide the Logger to the component, and the component should
not try to establish its own Logger (which is typically done in Log4J by
classname hierarchies).
Instead, the container has a structural model of the entire application, and
will hand a Logger to each component that is represented by such hierarchy.
Example;
<component name="House" class="org.hedhman.niclas.House" >
<component name="Floor1" class="org.hedhman.niclas.Floor" >
<component name="Room1" class="org.hedhman.niclas.Room" />
<component name="Room2" class="org.hedhman.niclas.Room" />
<component name="Room3" class="org.hedhman.niclas.Room" />
</component>
<component name="Floor2" class="org.hedhman.niclas.Floor" >
<component name="Room1" class="org.hedhman.niclas.Room" />
<component name="Room2" class="org.hedhman.niclas.Room" />
<component name="Room3" class="org.hedhman.niclas.Room" />
</component>
</component>
The container will construct the Loggers hierarchical to the above structure.
Loggers will be;
House
House.Floor1
House.Floor1.Room1
House.Floor1.Room2
House.Floor1.Room3
House.Floor2
House.Floor2.Room1
House.Floor2.Room2
House.Floor2.Room3
And it will make a lot more sense in production environments to organize
logging events according to this instead of package.class names.
I hope this expresses our usage pattern clearly enough.
Cheers
Niclas
More information about the slf4j-dev
mailing list