logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: discreet log types
Date Thu, 14 Aug 2003 21:10:25 GMT

If it can run, it can also walk!

I think the existing system can be made to closely simulate the behavior 
you describe.

Here is how:

- Set the root logger to the level OFF.

- Name your loggers as "fatal", "error", "timing", "CodeBlock", 
"ControlPoint", "DBAccess", "Info", etc. Set their levels to OFF when you 
create them.

- Whenever you can any of the above loggers, call it with the same printing 
metdod, say info(Object message) of the org.apache.log4j.Logger class.

To enable a "type" set its level to INFO or above. To disable it, set its 
level to DEBUG or lower. Assuming the "type" names do not contain dot ('.') 
characters, the "types" will be independent.

Do I need to continue?

At 04:25 PM 7/30/2003 -0700, Larry Young wrote:
>         I'm looking at creating a logging package for our applications 
> (web & non-web).   The reason for yet-another-logger is that I want 
> discreet logging types, not hierarchical levels.  I've built this kind of 
> a package before for previous projects, and ended up building the whole 
> thing because I didn't think log4j could do what I wanted (that was 
> several years ago).  Now I'm building another one, and looking at the 
> current version of log4j, and having read much of Ceki's book (which I 
> highly recommend!), I'm thinking that there's got to be a way of 
> re-configuring (bending?) log4j to do what I need.  I don't think it's 
> that far off.
>         Basically, I want to be able to enable/disable logging for a 
> particular class or package by type, and each type is totally independent 
> of every other type.  Some examples of types might be:  Fatal, Error, 
> Timing, CodeBlock, ControlPoint, DBAccess, Info, etc.  There is no 
> implicit "ordering" between these various types, so "levels" are 
> inappropriate. What I want to be able to do is to turn on/off each type 
> independently, so that I can turn on Timing without having to also turn 
> on Info, or be able to turn on CodeBlock without turning on Error.  I 
> also want the users of my package to be able to define additional types 
> and register them with the logger at runtime (via code or xml ???).  Oh 
> yeah, I also need to have the logger reload the config file (or some 
> portion of it) on a regular basis so that we can change the enabled types 
> without bouncing the app-server or restarting the application.
>         I was thinking if I tried to tie all my "types" to a single 
> "level", and did something with the log-level filtering to enable/disable 
> by package or class, that would get me close.  I'm not sure how I'd tie 
> in the "type".  I'd probably have to programatically update the log-level 
> filters with updates to handle config changes at runtime.
>         Thoughts, ideas, concerns???    Any comments are gratefully 
> accepted!  :)
>--- regards ---
>Larry Young
>The Dalmatian Group
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

Ceki For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message