logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronni Lück <Ronni.L...@sybase.com>
Subject Adding a Priority to the Appenders.
Date Thu, 04 Oct 2001 16:52:47 GMT
> Hi Log4J development team
> 
> We did need to log to the NT eventlog and a file (our own log), through
> the same category. Yes, that is not a problem because you just add the
> FileAppender class and the NTEventLogAppender class. 
> 
> But now all priorities (assuming that the priority for category is DEBUG)
> will be logged both in the file and in the NT eventlog. Our requirements
> state that only log messages with the priority FATAL should be logged to
> the NT eventlog and all should be logged to the file. This could be done
> if the appender classes had a priority.
> 
> Therefore I did modify the Appender and Appenderskeleton with a Priority
> attribute (see attached sourcecode) and a set/get method. After that I did
> recompile all the child classes (at least the ones I had to use) of the
> AppenderSkeleton class. The default for the Priority in the
> AppenderSkeleton is DEBUG (lowest level, so this will make everything
> works in current implementations which do not use this added
> functionality).
> 
> The method appendLoopOnAppenders in the AppenderAttachableImpl class also
> needed to be changed (see attached sourcecode), so that it checks the
> priority of the appender with the priority of the loggingevent.
> 
> I think this is a nice feature and would like your comment on it. 
> 
> Of course this uses the same technique, regarding priority, as the
> category class. But a really nice feature could be a prioritylist in the
> appenderSkeleton class. So a implemented appender (like FileAppender)
> could log message of for instance INFO and ERROR and not DEBUG, WARN and
> FATAL.
> 
> Please let me know if this suggestion could be done in a much nicer way. 
> 
> Venlig hilsen / Best regards
> 
> Ronni Lück
> 
> Sybase Professional Services, Denmark
> e-mail: ronni.luck@sybase.com
> mobile: +45 40 91 43 59
> phone: +45 39 27 79 13
> fax: +45 39 27 79 12
> 
>  <<Appender.java>>  <<AppenderSkeleton.java>>  
> <<AppenderAttachableImpl.java>> 

Mime
View raw message