Hi Avner, You'll be pleased to know that Ceki has done a LOT of work on refactoring the Rolling appender stuff for Log4j 1.3 (not yet released). I can't give 100% guarantee that the new changes are what you are looking for, but suffice to say his new design should make it a lot easier to customize behaviour.
Perhaps you could check out the jakarta-log4j module and see his new changes too see if it meets your needs? (we always love feedback! :) ) cheers, Paul Smith > -----Original Message----- > From: Avner BenHanoch [mailto:[EMAIL PROTECTED] > Sent: Sunday, 29 June 2003 9:38 PM > To: Log4J Users List > Subject: DailyRollingFileAppender - why isn't rollOver protected > > > I need to customize DailyRollingFileAppender, so rollOver > will check if > renaming the file is safe, before it renames it (because my > application > enable the user to view/query the log files). > What I need is that in case the file is being read, don't > rollOver, instead > try again on the next time a record is appended. > Unfortunately, this is not > possible, because rollOver is not protected. To my opinion > it should be > protected, otherwise there is no real option to extend the class. > > If one want more details, then here they come: At first I > wanted to do that > by inheriting DailyRollingFileAppender and overriding > subAppend. Then I > noticed that it won't work (because subAppend schedules the > time for next > rollOver, even if current rollOver failed - so it won't > happend on next time > a record is appended). Then I wanted to override rollOver to > raise a flag > that will be inspected on next subAppend, to see if a > rollOver is needed. > Unfortunately, this is not possible, because rollOver is not > protected. > What I did to solve my problem is a little bit ugly. I copied > DailyRollingFileAppender to my package without changes, changed its > packagename accordingly, then I could extend it from a file > in my package > and called rollOver. this worked fine, but I think it is > better if one > could change rollOver or subAppend in DRFA, so it will be > easier to extend > the file. > > thanks, > Avner > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]