logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: How to add a new logging level that is independent of the defualt ones.
Date Wed, 21 Dec 2005 05:33:13 GMT

On Dec 20, 2005, at 5:45 AM, Joseph, Shinoy wrote:

>
> Hi,
>     I am in need of adding a new level logging in to the log4j.  
> Requirement is that the new level should be independent of the  
> existing levels(debug,warn,info error,fatal etc).
>
> I have added the new level by extending Level, Logger and  
> LoggingFactory classes.
> Is it possible to do that by customizing log4j.xml ? It will be  
> great if some could guide me in this regard.
>
> Thanks & Regards
> Shinoy

As you've noticed, it isn't easy to do and it makes you maintain a  
branched version of log4j.

In many cases, people add levels for reasons that are much better  
addressed by using the logger hierarchy more effectively.  For  
example, they'd like to add a level SECURITY or AUDIT when that is  
more a description of the intended audience instead of the  
significance of the message to the audience.  In that case, having a  
branch of the logger hierarchy for security related messages  
("security.myapp.foo") is better than logging a message of  
Level.SECURITY to "myapp.foo".

If you explain your requirements, maybe we can find a decent solution  
that doesn't require you maintaining your own branched copy of log4j.


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