From: Kevin G. <ke...@go...> - 2002-11-15 18:36:11
|
Mark, nice job and thanks, but how are you handling multiple processes writing to the same log file? If you have a web server with 20 children logging to the same file, you're going to get race conditions like this: child1: hey, the log file is too big, time to rotate! child2: hey, the log file is too big, time to rotate! child1: renames current file to backup child2: renames empty current file to backup, kiboshes data That's why the apache utilities cronolog and rotatelogs both take the strategy of just writing to a different file after the cutoff, leaving the old file alone. I think the log4j method works for log4j because they typically only one JVM per machine and thus only one singleton logger. To do it the log4j way, we'd need to lock the log file before messing with it. (Actually, if we're renaming it, we need to keep the lock on a separate file). See the floc docs under perlfaq5 or File::Lock or maybe Logfile::Rotate, which looks like it uses locks, might be useful. What do you think? Pfeiffer, Mark (EDS) wrote: > Mike sorry draggin my heals on this :-( > > I have uploaded: > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.02.tar.gz > > to PAUSE for your consideration. It still needs plenty of work but at > least it is a start. > > Please note EDS email sucs. Please use the Reply-To field if you wish to > respond to me directly. Most "reasonable" email clients will understand. > > On Wed, 25 Sep 2002 19:54:02 EDT Msc...@ao...'s good news was: > > > > > > In a message dated 9/25/02 4:21:35 PM Pacific Daylight Time, > > mar...@ed... writes: > > > > > > > > > > I'll have a little look at Log::Dispatch and some of its sub-classes to > > see how it works. > > > > > > > > > > Also, the Java implementation shows some interesting ideas: > > > > > > http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/RollingFileApp > > ender.html > > > > Not that I'm implying you should provide the same interface, though :) > > > > -- Mike > > > > Mike Schilli > > log...@pe... > > http://perlmeister.com > > http://log4perl.sourceforge.net > > > > > cheers > markpf > > > ------------------------------------------------------- > This sf.net email is sponsored by: To learn the basics of securing > your web site with SSL, click here to get a FREE TRIAL of a Thawte > Server Certificate: http://www.gothawte.com/rd524.html > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |