Using monolog to log my exceptions:
try {
// php code
} catch (\Exception $e) {
$log->log(100, $e->getMessage());
}
I had problems when two parallel processes logging an error. Sometimes it worked correctly, but sometimes an error occurred saying that monolog log file “error.txt” could not be opened.
Using the native php error logging:
ini_set('error_log', "error_log.txt");
error_reporting(-1);
I had no problems so far.
Is it safe to make error logs with two parallel processes with this method ?
EDIT
$log refers to monolog Logger object:
$log = new Logger('error');
$log->pushHandler(new StreamHandler('error.txt', Logger::DEBUG));