I thought I’d mention that logger.rb does not rotate log files after it
has already rotated once. It does not set the sync flag to true when it
creates a new log file which means the stat.size call will always return 0
after the first rotation.
The following patch solves this issue:
$ diff -Nut /usr/lib/ruby/1.8/logger.rb ./logger.rb
— /usr/lib/ruby/1.8/logger.rb 2004-02-07 11:05:12.000000000 +0100
+++ ./logger.rb 2004-04-14 20:55:25.617250444 +0200
@@ -539,6 +539,7 @@
def create_logfile(filename)
logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT))
hth
Hi,
Xavier wrote:
I thought I’d mention that logger.rb does not rotate log files after it
has already rotated once. It does not set the sync flag to true when it
creates a new log file which means the stat.size call will always return 0
after the first rotation.
I don’t remember your first mail you mention here. Maybe I slipped a
message to ruby-bugs ML. And I’m very sorry for long silence.
I still don’t understand the problem (weekly shifting seems to work for
me…), but I think anyway IO#sync = true is a must as you said. I’ll
commit your path tonight.
Thank you for your patch and again apologize for not responding long time.
Regards,
// NaHi
Hi,
Xavier wrote:
I thought I’d mention that logger.rb does not rotate log files after it
has already rotated once. It does not set the sync flag to true when it
creates a new log file which means the stat.size call will always return 0
after the first rotation.
I don’t remember your first mail you mention here. Maybe I slipped a
message to ruby-bugs ML. And I’m very sorry for long silence.
What first email? That was my first post about this issue.
I still don’t understand the problem (weekly shifting seems to work for
me…), but I think anyway IO#sync = true is a must as you said. I’ll
commit your path tonight.
I’ve noticed it’s been included a few days ago:
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/lib/logger.rb.diff?r1=1.5.2.2;r2=1.5.2.3;f=h
Weekly rotations work because they do not need log file size.
Problem is rotation was done only once when based on size. Simply set a
small file size and start logging. The second log file, i.e. the first one
created by LogDevice::create_logfile did not have its sync flag raised and
would not be rotated because stat would return a 0-size. In other words,
you never got a 3rd log file.
Thank you for your patch and again apologize for not responding long
time.
No problem. I’m happy to see it’s been solved.
Regards.
···
On Mon, 10 May 2004 19:01:02 +0900, NAKAMURA, Hiroshi wrote:
Hi,
Xavier wrote:
What first email? That was my first post about this issue.
Don’t you submit this as a bug to jitterbug? I received a bug submit
notation as an e-mail.
I still don’t understand the problem (weekly shifting seems to work for
me…), but I think anyway IO#sync = true is a must as you said. I’ll
commit your path tonight.
I’ve noticed it’s been included a few days ago:
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/lib/logger.rb.diff?r1=1.5.2.2;r2=1.5.2.3;f=h
Doh. Thanks, matz. I only checked ChangeLog file.
Weekly rotations work because they do not need log file size.
Problem is rotation was done only once when based on size. Simply set a
small file size and start logging. The second log file, i.e. the
first one
created by LogDevice::create_logfile did not have its sync flag
raised and
would not be rotated because stat would return a 0-size. In other words,
you never got a 3rd log file.
I see the point. I didn’t know sync and stat relation problem. Thank
you for pointing out it.
Regards,
// NaHi