Subject: | size field in external config file with perl-style underscore, e.g. size=2_000_000 is ignored |
First, thanks for a very useful package.
SHORT STORY:
I noticed that "log4perl.appender.MYLOG.size=2_000_000" doesn't work.
The cause, I believe, is the underscore in the number.
LONG STORY:
Based on examples found online (*) I used Log::Dispatch::FileRotate with
an external config file which says:
log4perl.logger.LNU=INFO, LNU_LOG
log4perl.appender.LNU_LOG=Log::Dispatch::FileRotate
log4perl.appender.LNU_LOG.filename=/logfiles/myprocess.log
log4perl.appender.LNU_LOG.mode=append
log4perl.appender.LNU_LOG.size=2_000_000
but to my surprise, files were growing to 10MB before rotating
I believe the fault is in the "size=2_000_000", which clashes with the
following number regex test in new()
$size = $ten_meg unless $size =~ /^\d+$/ && $size < $two_gig && $size > 0;
Maybe I was supposed to know that I shouldn't use perl format in the
external file, but I didn't.
So for the benefit of other users, I'd suggest to either document this,
or adapt the code to allow this number format.
The obvious workaround is to omit the underscores from the number.
(*) e.g. here: http://lena.franken.de/perl_hier/log4perl.html (visited
last on 2008-11-19)