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

So that's pretty much the situation.

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


-----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:


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

View raw message