From 6d6b037e122e63ea7115c7da4f6fddbdeeb4d5ee Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 4 Jun 2015 04:53:23 +0100 Subject: [PATCH] resourceloader: Audit debug log channels and messages * Change "private module denied" level to 'debug'. This is quite unimportant and occupies over 90% of the logstash entries for resourceloader. * Changes all failure signals to 'warning' and using context data. Left out method in most case since the messages are unambiguous. Change-Id: Ibb2faaa54020ab0fd9685551689d9a89161e1ce7 --- includes/resourceloader/ResourceLoader.php | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 7cd0d19569..d5b17d8658 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -197,7 +197,9 @@ class ResourceLoader implements LoggerAwareInterface { } if ( !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) { - $this->logger->info( __METHOD__ . ": Invalid filter: $filter" ); + $this->logger->warning( 'Invalid filter {filter}', array( + 'filter' => $filter + ) ); return $data; } @@ -221,7 +223,9 @@ class ResourceLoader implements LoggerAwareInterface { $cache->set( $key, $result ); } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); - $this->logger->info( __METHOD__ . ": minification failed: $e" ); + $this->logger->warning( 'Minification failed: {exception}', array( + 'exception' => $e + ) ); $this->errors[] = self::formatExceptionNoComment( $e ); } } @@ -257,7 +261,7 @@ class ResourceLoader implements LoggerAwareInterface { $this->setLogger( $logger ); if ( !$config ) { - $this->logger->info( __METHOD__ . ' was called without providing a Config instance' ); + $this->logger->debug( __METHOD__ . ' was called without providing a Config instance' ); $config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); } $this->config = $config; @@ -650,7 +654,7 @@ class ResourceLoader implements LoggerAwareInterface { // Do not allow private modules to be loaded from the web. // This is a security issue, see bug 34907. if ( $module->getGroup() === 'private' ) { - $this->logger->info( __METHOD__ . ": request for private module '$name' denied" ); + $this->logger->debug( "Request for private module '$name' denied" ); $this->errors[] = "Cannot show private module \"$name\""; continue; } @@ -665,7 +669,9 @@ class ResourceLoader implements LoggerAwareInterface { $this->preloadModuleInfo( array_keys( $modules ), $context ); } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); - $this->logger->info( __METHOD__ . ": preloading module info failed: $e" ); + $this->logger->warning( 'Preloading module info failed: {exception}', array( + 'exception' => $e + ) ); $this->errors[] = self::formatExceptionNoComment( $e ); } @@ -675,7 +681,9 @@ class ResourceLoader implements LoggerAwareInterface { $versionHash = $this->getCombinedVersion( $context, array_keys( $modules ) ); } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); - $this->logger->info( __METHOD__ . ": calculating version hash failed: $e" ); + $this->logger->warning( 'Calculating version hash failed: {exception}', array( + 'exception' => $e + ) ); $this->errors[] = self::formatExceptionNoComment( $e ); } @@ -957,9 +965,9 @@ MESSAGE; $blobs = $this->blobStore->get( $this, $modules, $context->getLanguage() ); } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); - $this->logger->info( - __METHOD__ . ": pre-fetching blobs from MessageBlobStore failed: $e" - ); + $this->logger->warning( 'Prefetching MessageBlobStore failed: {exception}', array( + 'exception' => $e + ) ); $this->errors[] = self::formatExceptionNoComment( $e ); } } else { @@ -1072,7 +1080,9 @@ MESSAGE; } } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); - $this->logger->info( __METHOD__ . ": generating module package failed: $e" ); + $this->logger->warning( 'Generating module package failed: {exception}', array( + 'exception' => $e + ) ); $this->errors[] = self::formatExceptionNoComment( $e ); // Respond to client with error-state instead of module implementation -- 2.20.1