diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2024-03-18 10:59:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 10:59:28 +0100 |
commit | 3af954fcc876a7c35b2c71b138fc02c37fcf83c1 (patch) | |
tree | 8f66d3543a52c12e32bcac4926bcd345801f15a9 | |
parent | ce864b42771ec7b9f0e0c3017cca57a1f16a339a (diff) | |
parent | e838aa9514bb0ade137b5a763534707be4801a89 (diff) | |
download | nextcloud-server-3af954fcc876a7c35b2c71b138fc02c37fcf83c1.tar.gz nextcloud-server-3af954fcc876a7c35b2c71b138fc02c37fcf83c1.zip |
Merge pull request #44262 from nextcloud/fix/log-on-invalid-loglevel
fix(Logger): Warn on invalid `loglevel` configuration option
-rw-r--r-- | lib/private/Log.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php index ddccf87e073..b8f6d268930 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -282,7 +282,13 @@ class Log implements ILogger, IDataLogger { } $configLogLevel = $this->config->getValue('loglevel', ILogger::WARN); - return min(is_int($configLogLevel) ? $configLogLevel : ILogger::WARN, ILogger::FATAL); + if (is_numeric($configLogLevel)) { + return min((int)$configLogLevel, ILogger::FATAL); + } + + // Invalid configuration, warn the user and fall back to default level of WARN + error_log('Nextcloud configuration: "loglevel" is not a valid integer'); + return ILogger::WARN; } /** |