From 5f5cede104a6a6c4b67480649392d1a61a4780a2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 13 May 2020 16:06:26 -0400 Subject: [PATCH] Fix log file containing - or _ --- scripts/ZoneMinder/lib/ZoneMinder/Logger.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index 39c10a058..0513f563e 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -210,7 +210,7 @@ sub initialise( @ ) { if ( my $logFile = $this->getTargettedEnv('LOG_FILE') ) { $tempLogFile = $logFile; } - ($tempLogFile) = $tempLogFile =~ /^([\w\.\/]+)$/; + ($tempLogFile) = $tempLogFile =~ /^([_\-\w\.\/]+)$/; my $tempLevel = INFO; my $tempTermLevel = $this->{termLevel}; @@ -456,9 +456,9 @@ sub fileLevel { if ( defined($fileLevel) ) { $fileLevel = $this->limit($fileLevel); # The filename might have changed, so always close and re-open - $this->closeFile() if ( $this->{fileLevel} > NOLOG ); + $this->closeFile() if $this->{fileLevel} > NOLOG; $this->{fileLevel} = $fileLevel; - $this->openFile() if ( $this->{fileLevel} > NOLOG ); + $this->openFile() if $this->{fileLevel} > NOLOG; } return $this->{fileLevel}; } @@ -499,6 +499,7 @@ sub logFile { sub openFile { my $this = shift; + if ( open($LOGFILE, '>>', $this->{logFile}) ) { $LOGFILE->autoflush() if $this->{autoFlush}; @@ -519,7 +520,6 @@ sub openFile { } sub closeFile { - #my $this = shift; close($LOGFILE) if fileno($LOGFILE); }