logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DeSantis, MJ Mark @ IS (7179)" <Mark.J.DeSan...@L-3com.com>
Subject RE: Wrapping logger
Date Wed, 08 Feb 2006 18:39:20 GMT
I think I see your point - but I'll discribe our situation anyway and you
tell me what you think might be a resonable solution.

We have a window (advisory window) that is basically similar to chainsaw but
it's integrated into our program and it only shows logging events  that pass
a filter which filters for our custom advisory levels. 

We have a class that extends Logger which implements methods such as
advisoryFatal(), advisoryError(), advisoryWarn(), etc. And we have an
extended Level class which gives us our custom levels.

So basically if you call ourLogger.advisoryFatal("something is breaking");
that logging event will end up in the advisory window. This advisory window
is for nice, user-friendly, user-understandable, messages. So in other words
if we, for instance, caught an exception and wanted the stacktrace to go to
the file but we still wanted something for the user to show up in the window
we would do something like this:

}catch(Exception ex){
	ourLogger.fatal("Problem in such-and-such a window: ", ex);
	ourLogger.advisoryFatal("The window can not display because of
xyz");	
}


So that's pretty much the situation.

Do you think refactoring to a less "extended" approach is a possibility.

Mark









-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Wednesday, February 08, 2006 11:26 AM
To: Log4J Users List
Subject: Re: Wrapping logger


I strongly recommend avoiding it.

Many people feel that the need to add a new level when they are  
really trying to control the audience that receives the message, not  
the significance of the message to the audience.  If you are trying  
to control the audience, you can accomplish that through use of the  
logger name which does not require extending log4j.

See previous threads on this topic like:

http://mail-archives.apache.org/mod_mbox/logging-log4j-user/ 
200512.mbox/%3c56A5C4B2-BA1B-474F-8017-0D9763B27219@apache.org%3e
http://mail-archives.apache.org/mod_mbox/logging-log4j-user/ 
200508.mbox/% 
3c2F8048C5DB63E6498D846B0D08AF68670C54C6@LexMSX01.exstream.com%3e

If you still think you want to add a custom level, describe your  
scenario and maybe we can help you reach a better solution.


On Feb 8, 2006, at 9:57 AM, DeSantis, MJ Mark @ IS (7179) wrote:

> If I wanted to provide my own logger class which provided extra
> logging
> method calls associated with custom levels for my application, what  
> is the
> best way to wrap log4j's Logger class? Do I have to be concerned with
> implementing LoggerFactory?
>
> If anyone has done this please let me know and explain to how to do
> this.
>
>
> Mark


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

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


Mime
View raw message