[slf4j-dev] Re quest for a log message processing hook.

Ceki Gulcu ceki at qos.ch
Thu May 28 15:49:12 CEST 2009


ogradyjd wrote:
> I think I may have glossed over a major point in what I need to do.  The
> logging system has to continue working as it does now, with no knowledge
> that the log message stream is being forked.  One of the major problems I'm
> trying to get around is that the log files and configurations are under the
> purview of system administrators, meaning that changing any given part of
> the configuration like a logging level can take a few hours and requires
> review of several teams because of the sheer volume of logging output.  I'll
> put it to you this way - if I set the root logger to "trace" in production,
> we'd fill a terabyte drive in a few minutes.  And I'd still have to wait for
> the admins to send me a copy of the logs.

If the volume is so huge, you'd need to deal them very
efficiently. Eliminating disabled logging statement is one way in
which logging frameworks are specialized.

> So I cannot change the logging system as it is now in any way, meaning that
> the only way I can gain access to all logged messages whether the underlying
> logging system is set to accept them or not, is to intercept messages before
> the underlying logging system decides to throw them away.  And since our
> code uses several logging systems (legacy stuff almost never gets completely
> cleaned out), the only way to do this cleanly is to somehow instrument slf4j
> or commons logging to give me the log messages they get before they pass
> them to the underlying systems.

Does not compute. Any legacy is probably not going to use SLF4J
directly. I fail to see how your approach could work unless the
"legacy stuff" was using the SLF4J API directly.

> That's why my only path at this point, barring API hooks into commons
> logging or slf4j, is subclassing.  You're sure having hooks in slf4j is
> antithetical to its charter?  It sure would make it a heck of a lot more
> flexible.  Look at what plugins did for Eclipse and Firefox...

The underlying logging frameworks all have several extension points. SLF4J is 
not a logging framework but just an abstraction layer (for logging frameworks).


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-dev mailing list