Hi,

I'm in the (hardly unique, apparently :-) position of trying to decide how
to address some problems that my company's home-grown logging module has.
log4j has lots of very cool features, so I'm tempted to switch over, but I'm
not sure whether I've figured out some of the concepts, quite.

My main question has to do with how log4j achieves its "method invocation
plus an integer comparison" efficiency when I've got several
dynamically-configured appenders, on the same logger or perhaps on
ancestor/descendant loggers. The behavior I'd expect is that every appender
has a set of filters associated with it (that would most commonly look at
level only) and that log4j would take care of setting the level of each
logger instance based on what appenders that logger had to support. But I
can't find any documentation or log4j source code that talks about that, so
what I'm thinking instead is that appenders can do whatever funky filtering
they want to, and loggers can filter based on effective level, and the only
relationship between these two layers of filtering (appender and logger) is
that a message gets through only if it passes both tests. Is that right?

If so, has anyone thought about or coded a facility that would take a look
at all of the appender levels, and "precompute" the logger levels whenever
the appender/level configuration changes so that messages could be filtered
efficiently (i.e., "isGreaterOrEqual(this.getEffectiveLevel())") at the
logger stage? Right now, if I were to set logger levels based on what one
appender (a statically-configured FileAppender, say) needed, I don't see how
I could effectively keep that setting from conflicting with what made sense
for another appender (like a dynamically-attached SocketAppender, for
instance).

I get the feeling that maybe I'm confused because I'm trying to think about
log4j in the same terms as the logging code I'm used to, and they don't work
quite the same. Or maybe this does make sense in log4j and has already been
implemented, or isn't implemented yet but would be cool. Any thoughts?

-g.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to