Skip to content
Snippets Groups Projects
Unverified Commit 040c3b98 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo Committed by GitHub
Browse files

Fix some logic mistakes in the Logger class

The new `$initializing` property should signal that we are initializing the logging handler with a value of `true`, not the other way around. Also, it should only be set to `true` while we are actually initializing the logging handler.
parent 823f8ef8
No related branches found
No related tags found
No related merge requests found
......@@ -398,9 +398,6 @@ class Logger
register_shutdown_function([self::class, 'shutdown']);
self::$shutdownRegistered = true;
}
// Set initializing to true > all went well!
self::$initializing = true;
}
......@@ -411,6 +408,8 @@ class Logger
*/
private static function createLoggingHandler($handler = null)
{
self::$initializing = true;
// a set of known logging handlers
$known_handlers = [
'syslog' => 'SimpleSAML\Logger\SyslogLoggingHandler',
......@@ -450,6 +449,8 @@ class Logger
self::$format = $config->getString('logging.format', self::$format);
self::$loggingHandler->setLogFormat(self::$format);
self::$initializing = false;
}
......@@ -461,7 +462,7 @@ class Logger
*/
private static function log($level, $string, $statsLog = false)
{
if (self::$initializing === false) {
if (self::$initializing) {
// some error occurred while initializing logging
self::defer($level, $string, $statsLog);
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment