Daemon Logger: do not override given log level

fixes #2139
This commit is contained in:
Thomas Gelf 2020-06-06 23:29:31 +02:00
parent 25732aaf3e
commit f70df23e72
2 changed files with 8 additions and 4 deletions

View File

@ -32,6 +32,7 @@ next (will be 1.8.0)
* FEATURE: Self Service API ignores empty/missing properties (e.g. no address) * FEATURE: Self Service API ignores empty/missing properties (e.g. no address)
### Background Daemon ### Background Daemon
* FIX: Daemon Logger used to not override the given log level (#2139)
* FEATURE: Daemon: prepare for future reactphp promise versions (#2137) * FEATURE: Daemon: prepare for future reactphp promise versions (#2137)
### Internals ### Internals

View File

@ -8,12 +8,15 @@ use Icinga\Exception\ConfigurationError;
class Logger extends IcingaLogger class Logger extends IcingaLogger
{ {
public static function replaceRunningInstance(LogWriter $writer, $level = self::DEBUG) public static function replaceRunningInstance(LogWriter $writer, $level = null)
{ {
try { try {
self::$instance $instance = static::$instance;
->setLevel($level) if ($level !== null) {
->writer = $writer; $instance->setLevel($level);
}
$instance->writer = $writer;
} catch (ConfigurationError $e) { } catch (ConfigurationError $e) {
self::$instance->error($e->getMessage()); self::$instance->error($e->getMessage());
} }