Skip Menu |

This queue is for tickets about the Log-Dispatch-File-Rolling CPAN distribution.

Report information
The Basics
Id: 89001
Status: resolved
Priority: 0/
Queue: Log-Dispatch-File-Rolling

People
Owner: JACOB [...] cpan.org
Requestors: walkeraj [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.06
Fixed in: (no value)



Subject: module creates filenames with the pattern in them on startup.
When using this module with the synopsis code, an empty file named 'Somefile%d{yyyyMMdd}.log' will be created in the directory alongside the proper file. I suspect this is because of line 66 in Log/Dispatch/File/Rolling.pm: $self->_make_handle(%p); Which will in turn call $self->_open_file() in Log/Dispatch/File.pm Which will create a file using the uninterpolated filename string. Removing this line appears to make the module function as intended, given that the first time log_message is called, it will call $self->_createFilename(), see that the interpolated value is not the correct value, and open a new file with the correct interpolated value. A bit of an unintended hack, but it works.
Show quoted text
> When using this module with the synopsis code, an empty file named > 'Somefile%d{yyyyMMdd}.log' will be created in the directory alongside > the proper file. I suspect this is because of line 66 in > Log/Dispatch/File/Rolling.pm: > > $self->_make_handle(%p);
Yes, it's that line. Root cause is that the parent module changed it's _make_handle() method from using a paramter (%p) to using $self. Fix will be: # split pathname into path, basename, extension if ($p{filename} =~ /^(.*)\%d\{([^\}]*)\}(.*)$/) { $self->{rolling_filename_prefix} = $1; $self->{rolling_filename_postfix} = $3; $self->{rolling_filename_format} = Log::Log4perl::DateFormat->new($2); $self->{filename} = $self->_createFilename(); } elsif ($p{filename} =~ /^(.*)(\.[^\.]+)$/) { $self->{rolling_filename_prefix} = $1; $self->{rolling_filename_postfix} = $2; $self->{rolling_filename_format} = Log::Log4perl::DateFormat->new('-yyyy-MM-dd'); $self->{filename} = $self->_createFilename(); } else { $self->{rolling_filename_prefix} = $p{filename}; $self->{rolling_filename_postfix} = ''; $self->{rolling_filename_format} = Log::Log4perl::DateFormat->new('.yyyy-MM-dd'); $self->{filename} = $self->_createFilename(); } $self->{rolling_fh_pid} = $$; $self->_make_handle(); Will be fixed in next version.
From: phin [...] mailnesia.com
On Sat Sep 28 21:42:36 2013, JACOB wrote: Show quoted text
> Will be fixed in next version.
If you already have the solution why wait many months to release a fixed version?
On Mon Dec 09 02:03:16 2013, phin@mailnesia.com wrote: Show quoted text
> On Sat Sep 28 21:42:36 2013, JACOB wrote: >
> > Will be fixed in next version.
> > If you already have the solution why wait many months to release a > fixed version?
I was away from a machine I could use for it (no compiler/make) when I wrote that and then I forgot...
fixed in 1.07, which is currently processed by PAUSE