ReturnOfTheYeti has asked for the wisdom of the Perl Monks concerning the following question:
All, I am Windows SysAdmin with Zero knowledge of Perl. It has fallen into my lap to fix a script that worked on Server 2003, that no longer works "properly" in 2008 R2.
This is ActivePerl 5.16.3 Build 1603 (64-bit).
The issue is where it attempt to modify a log file. Here is the output:
Tue Jul 23 09:46:43 2013 (1374598003): THREAD-0: ERROR: Cannot rotate log file C:\faa\logs to path C:\faa\logs\QA-ENC04A_flashEnc.20130723094643.log: error code=Permission denied Failed in opening log file C:\faa\logs - using STDERR
The path is correct, and the logged in user has permissions to the file system, so I am not sure why I am getting the error.
Here is the code from the sript:
# Rotate old log file. rotateLogFile(); if ($configOptions{'logFilePath'}) { $LOG_FILE_PATH = $configOptions{'logFilePath'}; } if (!isLocalLoggingEnabled() && !$DEBUGMODE) { print "NOTE: Local logging disabled in script configuration fi +le\n"; } # Make sure we can log to a log file, if necessary. if ($LOG_FILE_PATH) { my $logFileHandle = getLogFileHandle(1); closeLogFileHandle($logFileHandle); } sub getLogFileHandle { my $logErrors = shift; # If no log file, use STDERR if (!$LOG_FILE_PATH) { return \*STDERR; } my $logFileHandle = IO::File->new(">>$LOG_FILE_PATH"); if (!(defined $logFileHandle)) { $logFileHandle = \*STDERR; if ($logErrors) { print STDERR "Failed in opening log file $LOG_FILE_PATH - +using STDERR\n"; } } autoflush $logFileHandle 1; return $logFileHandle; }
Any wisdom you can provide me with would be greatly appriciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WinAdmin needs help w/ File System STDERR and
by Old_Gray_Bear (Bishop) on Jul 23, 2013 at 17:52 UTC | |
by ReturnOfTheYeti (Initiate) on Jul 23, 2013 at 18:36 UTC | |
|
Re: WinAdmin needs help w/ File System STDERR and
by Loops (Curate) on Jul 23, 2013 at 17:30 UTC |