in reply to Re^4: file lock error
in thread file lock error

I also told logfile rotate Flock => no, but that does not rid of my error.

That can't be. That error is only given when Flock is 'yes' or not specified.

if( $self->{'Flock'} eq 'yes'){ $self->{'Fh'} = new IO::File "$self->{'File'}", O_WRONLY|O_EXC +L; croak "error: can not lock open: ($self->{'File'})" unless defined($self->{'Fh'}); flock($self->{'Fh'},LOCK_EX); }

But that doesn't matter. First, don't tell it not to lock.

Second, it's telling you it's having problem locking file "1". Is your log file really named 1? That's the file name you gave to it. One error is using

my $roll1 = @_;

when you mean to use

my ($roll1) = @_;

An array in scalar context returns the number of elements in the array.

Fix:

sub _logroll { eval 'use Compress::Zlib'; my $gzip = $@ ? '/usr/bin/gzip' : 'lib'; for my $log_file ( @_ ) { my $rotator = Logfile::Rotate->new( File => $log_file, Count => 15, Dir => $dir, Gzip => $gzip, Flock => 'yes', Persist => 'yes' ); $rotator->rotate(); } }