jenkins-bot has submitted this change and it was merged.

Change subject: Only send DB query profiling to MWDebug::query
......................................................................


Only send DB query profiling to MWDebug::query

This should avoid massive dberror log spam in jenkins.

Change-Id: Ifa60843e78b99921768e7a62109c505ff9330e41
---
M includes/debug/logger/LegacyLogger.php
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/debug/logger/LegacyLogger.php 
b/includes/debug/logger/LegacyLogger.php
index ef7a994..3318ceb 100644
--- a/includes/debug/logger/LegacyLogger.php
+++ b/includes/debug/logger/LegacyLogger.php
@@ -94,6 +94,13 @@
         * @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 @@
                        $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 );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/311853
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa60843e78b99921768e7a62109c505ff9330e41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to