Merge "exception: Use level=DEBUG for error-json (surpressed errors)"

This commit is contained in:
jenkins-bot 2020-02-12 06:50:09 +00:00 committed by Gerrit Code Review
commit ffd35f61c8

View file

@ -677,7 +677,14 @@ TXT;
$json = self::jsonSerializeException( $e, false, FormatJson::ALL_OK, $catcher );
if ( $json !== false ) {
$logger = LoggerFactory::getInstance( "{$channel}-json" );
$logger->log( $level, $json, [ 'private' => true ] );
// Unlike the 'error' channel, the 'error-json' channel is unfiltered,
// and emits messages even if wikimedia/at-ease was used to suppress the
// error. To avoid clobbering Logstash dashboards with these, make sure
// those have their level casted to DEBUG so that they are excluded by
// level-based filteres automatically instead of requiring a dedicated filter
// for this channel. To be improved: T193472.
$unfilteredLevel = $suppressed ? LogLevel::DEBUG : $level;
$logger->log( $unfilteredLevel, $json, [ 'private' => true ] );
}
Hooks::run( 'LogException', [ $e, $suppressed ] );