You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ronni Lück <Ro...@sybase.com> on 2001/10/04 18:52:47 UTC

Adding a Priority to the Appenders.

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