Skip to content

fix: Use configured loglevel even when log.condition matches is set#58601

Merged
SystemKeeper merged 1 commit intomasterfrom
fix/noid/default-loglevel-with-match-condition
Feb 27, 2026
Merged

fix: Use configured loglevel even when log.condition matches is set#58601
SystemKeeper merged 1 commit intomasterfrom
fix/noid/default-loglevel-with-match-condition

Conversation

@SystemKeeper
Copy link
Contributor

@SystemKeeper SystemKeeper commented Feb 26, 2026

Right now as soon as we have a matches setting for log.condition, we skip the default loglevel at:

server/lib/private/Log.php

Lines 272 to 283 in 4d00f49

if (!isset($logCondition['matches'])) {
$configLogLevel = $this->config->getValue('loglevel', ILogger::WARN);
if (is_numeric($configLogLevel)) {
$this->nestingLevel--;
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');
$this->nestingLevel--;
return ILogger::WARN;
}

and if the current logline does not match, we always use WARN:

server/lib/private/Log.php

Lines 303 to 304 in 4d00f49

$this->nestingLevel--;
return ILogger::WARN;

  • Set the loglevel in config.php to < WARN (e.g. 1 for INFO)
  • Define a log.condition => matches that does not match
  • Observe that only warnings and above are logged

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
@SystemKeeper SystemKeeper added this to the Nextcloud 33.0.1 milestone Feb 26, 2026
@SystemKeeper SystemKeeper self-assigned this Feb 26, 2026
@SystemKeeper SystemKeeper requested a review from a team as a code owner February 26, 2026 22:18
@SystemKeeper SystemKeeper requested review from ArtificialOwl and removed request for a team February 26, 2026 22:18
@SystemKeeper

This comment was marked as outdated.

@SystemKeeper

This comment was marked as outdated.

@SystemKeeper
Copy link
Contributor Author

/backport to stable33 please

@SystemKeeper
Copy link
Contributor Author

/backport to stable32 please

@SystemKeeper SystemKeeper merged commit 00af121 into master Feb 27, 2026
175 of 177 checks passed
@SystemKeeper SystemKeeper deleted the fix/noid/default-loglevel-with-match-condition branch February 27, 2026 15:00
@backportbot

This comment was marked as resolved.

@SystemKeeper
Copy link
Contributor Author

/backport to stable32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants