From e861191b2cdceeeeceec8d81d6bbd741712cdbaf Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 20 Sep 2016 15:42:00 -0700 Subject: [PATCH] Only send DB query profiling to MWDebug::query This should avoid massive dberror log spam in jenkins. Change-Id: Ifa60843e78b99921768e7a62109c505ff9330e41 --- includes/debug/logger/LegacyLogger.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index ef7a994c9e..3318ceb037 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -94,6 +94,13 @@ class LegacyLogger extends AbstractLogger { * @return null */ public function log( $level, $message, array $context = [] ) { + if ( $this->channel === 'DBQuery' && isset( $context['method'] ) + && isset( $context['master'] ) && isset( $context['runtime'] ) + ) { + MWDebug::query( $message, $context['method'], $context['master'], $context['runtime'] ); + return; // only send profiling data to MWDebug profiling + } + if ( isset( self::$dbChannels[$this->channel] ) && isset( self::$levelMapping[$level] ) && self::$levelMapping[$level] >= LogLevel::ERROR @@ -109,11 +116,7 @@ class LegacyLogger extends AbstractLogger { $destination = self::destination( $effectiveChannel, $message, $context ); self::emit( $text, $destination ); } - if ( $this->channel === 'DBQuery' && isset( $context['method'] ) - && isset( $context['master'] ) && isset( $context['runtime'] ) - ) { - MWDebug::query( $message, $context['method'], $context['master'], $context['runtime'] ); - } elseif ( !isset( $context['private'] ) || !$context['private'] ) { + if ( !isset( $context['private'] ) || !$context['private'] ) { // Add to debug toolbar if not marked as "private" MWDebug::debugMsg( $message, [ 'channel' => $this->channel ] + $context ); } -- 2.20.1