From: <Msc...@ao...> - 2002-09-25 07:47:10
|
In a message dated 9/24/02 9:34:20 PM Pacific Daylight Time, mar...@ed... writes: > I have a long running process and I want to rotate my logs files without > having to stop and start my app. How do I close logfiles? Or is there > some way of log4perl rotating for me? Or can I have a logfile > open->written->closed for each message? > Actually, the Log::Dispatch appender should take care of that. There should be something like Log::Dispatch::FileRotate, but -- just checked -- there isn't. Dave, is there an appender that rotates logfiles similar to the rotating file appenders of the Java world? -- Mike Mike Schilli log...@pe... http://perlmeister.com |
From: Pfeiffer, M. (EDS) <mar...@ed...> - 2002-09-25 23:20:45
|
On Wed, 25 Sep 2002 11:11:50 EST Dave Rolsky's good news was: > On Wed, 25 Sep 2002 Msc...@ao... wrote: > > > Actually, the Log::Dispatch appender should take care of that. There should > > be something like Log::Dispatch::FileRotate, but -- just checked -- there > > isn't. > > Dave, is there an appender that rotates logfiles similar to the rotating file > > appenders of the Java world? > > Nope, there isn't. But of course some could write one and put it on CPAN > ;) > I'm not adverse to writing some Perl... If that is what your implying. I havn't had a good look at the code yet but I am sure I could help out. I'll have a little look at Log::Dispatch and some of its sub-classes to see how it works. cheers mark __ Mark Pfeiffer <ma...@ml...> |
From: Dave R. <au...@ur...> - 2002-09-25 23:23:56
|
On Thu, 26 Sep 2002, Pfeiffer, Mark (EDS) wrote: > > Nope, there isn't. But of course some could write one and put it on CPAN > > ;) > > > I'm not adverse to writing some Perl... If that is what your implying. I > havn't had a good look at the code yet but I am sure I could help out. That was what I was getting at. > I'll have a little look at Log::Dispatch and some of its sub-classes to > see how it works. Writing a new Log::Dispatch output object is trivially simple. Most of the outputs are about 100 lines of code or less (not including docs). -dave /*================== www.urth.org we await the New Sun ==================*/ |
From: <Msc...@ao...> - 2002-09-25 23:54:48
|
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/RollingFileAppender. 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 |
From: Pfeiffer, M. (EDS) <mar...@ed...> - 2002-09-26 00:13:18
|
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 :) > Ok I'll look at that as well ;-) cheers mark |
From: Pfeiffer, M. (EDS) <mar...@ed...> - 2002-09-27 07:39:24
|
Ok, I have some code to put up that looks like it works reasonably well. I'm not saying it is good code only the bits I stole from Dave Rolsky :-) It still needs some more doco and some fancy bits but it is ready for you guys to look at and comment. I don't have a Makefile yet and I don't have a CPAN account. I'll try and get that done early next week and put the code up. If you're interested in commenting before that time drop me an email in the next little while (as I'm going away over the weekend) and I'll email the code to you. It isn't large 250 lines including Dave's pod. This was a joy to do I must say. The architecure is very flexibile and understandable. Great job people! cheers mark |
From: mark p. <mar...@ed...> - 2002-11-15 04:46:22
|
2nd try since EDS messed with my email address !@#$#@ Mike, sorry for dragging my heals on this... I have uploaded file: $CPAN/authors/id/M/MA/MARKPF/Log-Dispatch-FileRotate-1.02.tar.gz size: 3780 bytes md5: b798c2845b3ad31e6c820424277e8adb for your edification. It is a start but still needs more work. 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 cheers mark __ Mark Pfeiffer <mar...@ed...> Mark Pfeiffer <ma...@ml...> TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 Snail: L5, 48 Martin Place, Sydney, Australia ---- Legal ------ Important: This email message and attachments (if any) are confidential and may be legally privileged. If you are not the intended recipient, you must not disclose, copy or use the information contained in it in any way. If you have received this email in error, please advise immediately by return email and delete this email and its attachments (if any). Thank you. |
From: Pfeiffer, M. (EDS) <mar...@ed...> - 2002-11-15 05:54:56
|
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 |
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 |
From: mark p. <mar...@ed...> - 2002-11-17 22:25:36
|
Thanks for the feedback Kevin. I'll chase up your leads and do some proper testing... What you are saying is absolutely correct! On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > 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 cheers mark __ Mark Pfeiffer <mar...@ed...> Mark Pfeiffer <ma...@ml...> TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 Snail: L5, 48 Martin Place, Sydney, Australia ---- Legal ------ Important: This email message and attachments (if any) are confidential and may be legally privileged. If you are not the intended recipient, you must not disclose, copy or use the information contained in it in any way. If you have received this email in error, please advise immediately by return email and delete this email and its attachments (if any). Thank you. |
From: mark p. <mar...@ed...> - 2002-11-18 06:33:58
|
A new version has just been uploaded to PAUSE: M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz should handle multiple writers. On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > Thanks for the feedback Kevin. I'll chase up your leads and do some > proper testing... What you are saying is absolutely correct! > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > 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? > > ... snip ... cheers mark |
From: Kevin G. <ke...@go...> - 2002-11-18 19:09:12
|
Stylin! I've added a map to the log4j syntax so it can be set up like this: log4j.appender.apndr=org.apache.log4j.RollingFileAppender log4j.appender.apndr.File=app.log log4j.appender.apndr.MaxFileSize=15_000_000 log4j.appender.apndr.MaxBackupIndex=2 log4j.appender.apndr.layout=org.apache.log4j.SimpleLayout I don't suppose you have an overwhelming urge to implement DailyRollingFileAppender while you're at it? mark pfeiffer wrote: > A new version has just been uploaded to PAUSE: > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz > > should handle multiple writers. > > On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > > > Thanks for the feedback Kevin. I'll chase up your leads and do some > > proper testing... What you are saying is absolutely correct! > > > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > > 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? > > > > ... snip ... > > cheers > mark -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: mark p. <mar...@ed...> - 2002-11-20 03:33:51
|
Just uploaded a time based one. M/MA/MARKPF/Log-Dispatch-FileRotate-1.04.tar.gz Let me know what you guys think. On Mon, 18 Nov 2002 11:08:10 -0800 Kevin Goess's good news was: > Stylin! I've added a map to the log4j syntax so it can be set up like this: > > log4j.appender.apndr=org.apache.log4j.RollingFileAppender > log4j.appender.apndr.File=app.log > log4j.appender.apndr.MaxFileSize=15_000_000 > log4j.appender.apndr.MaxBackupIndex=2 > log4j.appender.apndr.layout=org.apache.log4j.SimpleLayout > > I don't suppose you have an overwhelming urge to implement > DailyRollingFileAppender while you're at it? > > > mark pfeiffer wrote: > > A new version has just been uploaded to PAUSE: > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz > > > > should handle multiple writers. > > > > On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > > > > > Thanks for the feedback Kevin. I'll chase up your leads and do some > > > proper testing... What you are saying is absolutely correct! > > > > > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > > > 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? > > > > > > ... snip ... > > > > cheers > > mark > > > -- > Happy Trails . . . > > Kevin M. Goess > (and Anne and Frank) > 904 Carmel Ave. > Albany, CA 94706 > (510) 525-5217 cheers mark __ Mark Pfeiffer <mar...@ed...> Mark Pfeiffer <ma...@ml...> TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 Snail: L5, 48 Martin Place, Sydney, Australia ---- Legal ------ Important: This email message and attachments (if any) are confidential and may be legally privileged. If you are not the intended recipient, you must not disclose, copy or use the information contained in it in any way. If you have received this email in error, please advise immediately by return email and delete this email and its attachments (if any). Thank you. |
From: Kevin G. <ke...@go...> - 2002-11-20 18:24:34
|
Mark, I noticed your hash key is sometimes LFD and sometimes LDF, running with -w shows error messages like this: Use of uninitialized value in ref-to-glob cast at blib/lib/Log/Dispatch/FileRotate.pm line 405. flock() on unopened filehandle at blib/lib/Log/Dispatch/FileRotate.pm line 405. Use of uninitialized value in ref-to-glob cast at blib/lib/Log/Dispatch/FileRotate.pm line 417. mark pfeiffer wrote: > Just uploaded a time based one. > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.04.tar.gz > > Let me know what you guys think. > > > On Mon, 18 Nov 2002 11:08:10 -0800 Kevin Goess's good news was: > > Stylin! I've added a map to the log4j syntax so it can be set up like this: > > > > log4j.appender.apndr=org.apache.log4j.RollingFileAppender > > log4j.appender.apndr.File=app.log > > log4j.appender.apndr.MaxFileSize=15_000_000 > > log4j.appender.apndr.MaxBackupIndex=2 > > log4j.appender.apndr.layout=org.apache.log4j.SimpleLayout > > > > I don't suppose you have an overwhelming urge to implement > > DailyRollingFileAppender while you're at it? > > > > > > mark pfeiffer wrote: > > > A new version has just been uploaded to PAUSE: > > > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz > > > > > > should handle multiple writers. > > > > > > On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > > > > > > > Thanks for the feedback Kevin. I'll chase up your leads and do some > > > > proper testing... What you are saying is absolutely correct! > > > > > > > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > > > > 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? > > > > > > > > ... snip ... > > > > > > cheers > > > mark > > > > > > -- > > Happy Trails . . . > > > > Kevin M. Goess > > (and Anne and Frank) > > 904 Carmel Ave. > > Albany, CA 94706 > > (510) 525-5217 > > cheers > mark > __ > Mark Pfeiffer <mar...@ed...> > Mark Pfeiffer <ma...@ml...> > TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 > Snail: L5, 48 Martin Place, Sydney, Australia > > ---- Legal ------ > Important: This email message and attachments (if any) are confidential > and may be legally privileged. If you are not the intended recipient, > you must not disclose, copy or use the information contained in it > in any way. If you have received this email in error, please advise > immediately by return email and delete this email and its attachments > (if any). Thank you. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: mark p. <mar...@ed...> - 2002-11-20 22:40:06
|
Oops ;-( typo! test.pl now uses -w. Yes, I know, a HUGE oversite! All fixed in Version 1.05 On Wed, 20 Nov 2002 10:23:30 -0800 Kevin Goess's good news was: > Mark, I noticed your hash key is sometimes LFD and sometimes LDF, > running with -w shows error messages like this: > > Use of uninitialized value in ref-to-glob cast at > blib/lib/Log/Dispatch/FileRotate.pm line 405. > flock() on unopened filehandle at blib/lib/Log/Dispatch/FileRotate.pm > line 405. > Use of uninitialized value in ref-to-glob cast at > blib/lib/Log/Dispatch/FileRotate.pm line 417. > > > mark pfeiffer wrote: > > Just uploaded a time based one. > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.04.tar.gz > > > > Let me know what you guys think. > > > > > > On Mon, 18 Nov 2002 11:08:10 -0800 Kevin Goess's good news was: > > > Stylin! I've added a map to the log4j syntax so it can be set up like this: > > > > > > log4j.appender.apndr=org.apache.log4j.RollingFileAppender > > > log4j.appender.apndr.File=app.log > > > log4j.appender.apndr.MaxFileSize=15_000_000 > > > log4j.appender.apndr.MaxBackupIndex=2 > > > log4j.appender.apndr.layout=org.apache.log4j.SimpleLayout > > > > > > I don't suppose you have an overwhelming urge to implement > > > DailyRollingFileAppender while you're at it? > > > > > > > > > mark pfeiffer wrote: > > > > A new version has just been uploaded to PAUSE: > > > > > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz > > > > > > > > should handle multiple writers. > > > > > > > > On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > > > > > > > > > Thanks for the feedback Kevin. I'll chase up your leads and do some > > > > > proper testing... What you are saying is absolutely correct! > > > > > > > > > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > > > > > 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? > > > > > > > > > > ... snip ... > > > > > > > > cheers > > > > mark > > > > > > > > > -- > > > Happy Trails . . . > > > > > > Kevin M. Goess > > > (and Anne and Frank) > > > 904 Carmel Ave. > > > Albany, CA 94706 > > > (510) 525-5217 > > > > cheers > > mark > > __ > > Mark Pfeiffer <mar...@ed...> > > Mark Pfeiffer <ma...@ml...> > > TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 > > Snail: L5, 48 Martin Place, Sydney, Australia > > > > ---- Legal ------ > > Important: This email message and attachments (if any) are confidential > > and may be legally privileged. If you are not the intended recipient, > > you must not disclose, copy or use the information contained in it > > in any way. If you have received this email in error, please advise > > immediately by return email and delete this email and its attachments > > (if any). Thank you. > > > -- > Happy Trails . . . > > Kevin M. Goess > (and Anne and Frank) > 904 Carmel Ave. > Albany, CA 94706 > (510) 525-5217 cheers mark __ Mark Pfeiffer <mar...@ed...> Mark Pfeiffer <ma...@ml...> TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 Snail: L5, 48 Martin Place, Sydney, Australia ---- Legal ------ Important: This email message and attachments (if any) are confidential and may be legally privileged. If you are not the intended recipient, you must not disclose, copy or use the information contained in it in any way. If you have received this email in error, please advise immediately by return email and delete this email and its attachments (if any). Thank you. |
From: Kevin G. <ke...@go...> - 2002-11-23 23:27:38
Attachments:
032JRollFile.t
|
Mark, thanks for fixing that, but when I run 'make test' for version 1.05 the test runs for at least 8 minutes before I get bored and kill it. Looking at the test script, you don't actually seem to be testing anything, you're just running it for a long time, all the files could be ending up in /dev/null for all the test can tell. Might I be so bold as to suggest 1) If the test really needs to run for longer than about five seconds then tell the user in advance how long the test is expected to take. Nobody's going to want to run the test if it takes 10 minutes. But what are you actually testing with all those iterations? 2) To actually test the functionality, log enough bytes so that the logfile rolls and then check the contents of "file.log" and "file.log.1". You might take a look at the test I wrote to test the interface to FileRotate, attached, and do something like that (although Mike S. says he's seen it misbehave, so it might not be the best thing to steal from). 3) You should really test the file locking, there' enought code there that it should be tested. This would involve refactoring the module so that the test script can pause a logging operation right after it locks the file and then launch another logging operation to see if it does the right thing. 4) The test script sleeps for 180 seconds, so for 3 minutes + run time. I gave up running it after about 8 minutes, so that would imply there's some horrible runtime inefficiency going on? Could you check that out? mark pfeiffer wrote: > > Oops ;-( typo! > > test.pl now uses -w. Yes, I know, a HUGE oversite! > > All fixed in Version 1.05 > > On Wed, 20 Nov 2002 10:23:30 -0800 Kevin Goess's good news was: > > Mark, I noticed your hash key is sometimes LFD and sometimes LDF, > > running with -w shows error messages like this: > > > > Use of uninitialized value in ref-to-glob cast at > > blib/lib/Log/Dispatch/FileRotate.pm line 405. > > flock() on unopened filehandle at blib/lib/Log/Dispatch/FileRotate.pm > > line 405. > > Use of uninitialized value in ref-to-glob cast at > > blib/lib/Log/Dispatch/FileRotate.pm line 417. > > > > > > mark pfeiffer wrote: > > > Just uploaded a time based one. > > > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.04.tar.gz > > > > > > Let me know what you guys think. > > > > > > > > > On Mon, 18 Nov 2002 11:08:10 -0800 Kevin Goess's good news was: > > > > Stylin! I've added a map to the log4j syntax so it can be set up like this: > > > > > > > > log4j.appender.apndr=org.apache.log4j.RollingFileAppender > > > > log4j.appender.apndr.File=app.log > > > > log4j.appender.apndr.MaxFileSize=15_000_000 > > > > log4j.appender.apndr.MaxBackupIndex=2 > > > > log4j.appender.apndr.layout=org.apache.log4j.SimpleLayout > > > > > > > > I don't suppose you have an overwhelming urge to implement > > > > DailyRollingFileAppender while you're at it? > > > > > > > > > > > > mark pfeiffer wrote: > > > > > A new version has just been uploaded to PAUSE: > > > > > > > > > > M/MA/MARKPF/Log-Dispatch-FileRotate-1.03.tar.gz > > > > > > > > > > should handle multiple writers. > > > > > > > > > > On Mon, 18 Nov 2002 09:23:02 +1100 mark pfeiffer's good news was: > > > > > > > > > > > > Thanks for the feedback Kevin. I'll chase up your leads and do some > > > > > > proper testing... What you are saying is absolutely correct! > > > > > > > > > > > > On Fri, 15 Nov 2002 10:35:19 -0800 Kevin Goess's good news was: > > > > > > > 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? > > > > > > > > > > > > ... snip ... > > > > > > > > > > cheers > > > > > mark > > > > > > > > > > > > -- > > > > Happy Trails . . . > > > > > > > > Kevin M. Goess > > > > (and Anne and Frank) > > > > 904 Carmel Ave. > > > > Albany, CA 94706 > > > > (510) 525-5217 > > > > > > cheers > > > mark > > > __ > > > Mark Pfeiffer <mar...@ed...> > > > Mark Pfeiffer <ma...@ml...> > > > TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 > > > Snail: L5, 48 Martin Place, Sydney, Australia > > > > > > ---- Legal ------ > > > Important: This email message and attachments (if any) are confidential > > > and may be legally privileged. If you are not the intended recipient, > > > you must not disclose, copy or use the information contained in it > > > in any way. If you have received this email in error, please advise > > > immediately by return email and delete this email and its attachments > > > (if any). Thank you. > > > > > > -- > > Happy Trails . . . > > > > Kevin M. Goess > > (and Anne and Frank) > > 904 Carmel Ave. > > Albany, CA 94706 > > (510) 525-5217 > > cheers > mark > __ > Mark Pfeiffer <mar...@ed...> > Mark Pfeiffer <ma...@ml...> > TCNZA EMC IB | Mobile: 0414 771 245 | Phone: +61 2 9378 5024 > Snail: L5, 48 Martin Place, Sydney, Australia > > ---- Legal ------ > Important: This email message and attachments (if any) are confidential > and may be legally privileged. If you are not the intended recipient, > you must not disclose, copy or use the information contained in it > in any way. If you have received this email in error, please advise > immediately by return email and delete this email and its attachments > (if any). Thank you. > > ------------------------------------------------------- > This sf.net email is sponsored by: > Battle your brains against the best in the Thawte Crypto > Challenge. Be the first to crack the code - register now: > http://www.gothawte.com/rd521.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 |
From: <msc...@ao...> - 2002-11-23 23:43:31
|
In a message dated 11/23/2002 6:25:08 PM Eastern Standard Time, Kevin Goess <ke...@go...> writes: > (although > Mike S. says he's seen it misbehave, so it might not > be the best thing to steal from). Actually, I only saw it fail with a previous (maybe inofficial) version of the Rotating log file appender, so no need to worry -- and I certainly agree that running a test for more than a couple of seconds defies the purpose of the test because people will either not install the module or just skip the test. Less is more in this case :) -- Mike ############################ # Mike Schilli # # log...@pe... # # http://perlmeister.com # # log4perl.sourceforge.net # ############################ |
From: mark p. <mar...@ed...> - 2002-11-24 23:29:56
|
On Sat, 23 Nov 2002 15:25:08 -0800 Kevin Goess's good news was: > > Mark, thanks for fixing that, but when I run 'make test' for version > 1.05 the test runs for at least 8 minutes before I get bored and kill > it. Looking at the test script, you don't actually seem to be testing > anything, you're just running it for a long time, all the files could be > ending up in /dev/null for all the test can tell. Might I be so bold as > to suggest > It is testing time based rotation. Which takes time not bytes to tickle. But you are right, it is boring and provides little feedback. > 1) If the test really needs to run for longer than about five seconds > then tell the user in advance how long the test is expected to take. > Nobody's going to want to run the test if it takes 10 minutes. But what > are you actually testing with all those iterations? > Time based rotation. I left the granularity up too high. > 2) To actually test the functionality, log enough bytes so that the > logfile rolls and then check the contents of "file.log" and > "file.log.1". You might take a look at the test I wrote to test the > interface to FileRotate, attached, and do something like that (although > Mike S. says he's seen it misbehave, so it might not be the best thing > to steal from). > I'll look at it. > 3) You should really test the file locking, there' enought code there > that it should be tested. This would involve refactoring the module so > that the test script can pause a logging operation right after it locks > the file and then launch another logging operation to see if it does the > right thing. > Once again I'll look into it. > 4) The test script sleeps for 180 seconds, so for 3 minutes + run time. > I gave up running it after about 8 minutes, so that would imply there's > some horrible runtime inefficiency going on? Could you check that out? > Hmm, ran it on my box and it took 3m0.639s. Not sure what you were seeing when you ran it. The sleep was so that I could run multiple "make test"'s from multiple xterms, so I could watch the time rotation and locking happening. Simple and crude but an effective way of watching what was going on. It is probably not what potential users want to see. I guess there needs to be a way of turning long running tests off or shortening them significantly - whilst making sure all aspects are being tested. The unfortunate issue is that there are branches in the code that will never get tested until someone wants a log rotated at greater than a yearly period. I guess I could trick time_to_rotate() into thinking it's time when it isn't really. > mark pfeiffer wrote: > > > > Oops ;-( typo! > > > ... snip ... cheers mark (who is not an idiot.... Just reeaaallllyyyyy sllooowwww :-) ) |
From: Kevin G. <ke...@go...> - 2002-09-25 15:42:08
|
Msc...@ao... wrote: > In a message dated 9/24/02 9:34:20 PM Pacific Daylight Time, > mar...@ed... writes: > >> I have a long running process and I want to rotate my logs files without >> having to stop and start my app. How do I close logfiles? Or is there >> some way of log4perl rotating for me? Or can I have a logfile >> open->written->closed for each message? If it's any comfort, our to-do list has plans to implement stuff corresponding to the java RollingFileAppender and DailyRolllingFileAppender. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Dave R. <au...@ur...> - 2002-09-25 16:12:00
|
On Wed, 25 Sep 2002 Msc...@ao... wrote: > Actually, the Log::Dispatch appender should take care of that. There should > be something like Log::Dispatch::FileRotate, but -- just checked -- there > isn't. > Dave, is there an appender that rotates logfiles similar to the rotating file > appenders of the Java world? Nope, there isn't. But of course some could write one and put it on CPAN ;) -dave /*================== www.urth.org we await the New Sun ==================*/ |