Fix: Bad error management

This commit is contained in:
Laurent Destailleur 2013-01-18 12:09:39 +01:00
parent 57a869683d
commit 7c826dc38d

View File

@ -116,13 +116,17 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
if (defined("SYSLOG_FILE_NO_ERROR")) $filefd = @fopen($logfile, 'a+'); if (defined("SYSLOG_FILE_NO_ERROR")) $filefd = @fopen($logfile, 'a+');
else $filefd = fopen($logfile, 'a+'); else $filefd = fopen($logfile, 'a+');
if (!$filefd && ! defined("SYSLOG_FILE_NO_ERROR")) if (! $filefd)
{
if (! defined("SYSLOG_FILE_NO_ERROR"))
{ {
// Do not break dolibarr usage if log fails // Do not break dolibarr usage if log fails
//throw new Exception('Failed to open log file '.basename($logfile)); //throw new Exception('Failed to open log file '.basename($logfile));
print 'Failed to open log file '.basename($logfile); print 'Failed to open log file '.basename($logfile);
} }
}
else
{
$logLevels = array( $logLevels = array(
LOG_EMERG => 'EMERG', LOG_EMERG => 'EMERG',
LOG_ALERT => 'ALERT', LOG_ALERT => 'ALERT',
@ -139,4 +143,5 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
fwrite($filefd, $message."\n"); fwrite($filefd, $message."\n");
fclose($filefd); fclose($filefd);
} }
}
} }