From: Alexandre Emsenhuber Date: Thu, 27 Mar 2014 09:46:40 +0000 (+0100) Subject: Send the profiler output to the 'profileoutput' log group X-Git-Tag: 1.31.0-rc.0~16426^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=d966a5266f052bd032ed5c833c2b233c284b28f3;p=lhc%2Fweb%2Fwiklou.git Send the profiler output to the 'profileoutput' log group And deprecate $wgProfileOnly in the same time. This has the advantage of allowing profiler output to be separated from the main debug log file; or even be completely disabled while keeping the other debugging messages. Also updated the checks in wfLogProfilingData() to detect the cases where the output would not be sent anywhere to not execute the last part of the method which would be useless otherwise. Backward compatibility with installations having $wgProfileOnly set to true is kept by moving the log file from $wgDebugLogFile to $wgDebugLogGroups['profileoutput'] in Setup.php in that case. Change-Id: I7b35195e527dfa7978b710126ed4599e75dab46b --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 92e94ed65d..cf204542b1 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -52,6 +52,8 @@ production. wgQueryPages hook. * $wgHttpOnlyBlacklist has been removed. * $wgLicenseTerms has been removed as it was unused. +* $wgProfileOnly is now deprecated; set the log file in + $wgDebugLogGroups['profileoutput'] to replace it. === New features in 1.23 === * ResourceLoader can utilize the Web Storage API to cache modules client-side. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 871319c50f..0ea3350e42 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5067,6 +5067,9 @@ $wgProfileLimit = 0.0; /** * Don't put non-profiling info into log file + * + * @deprecated since 1.23, set the log file in + * $wgDebugLogGroups['profileoutput'] instead. */ $wgProfileOnly = false; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 3727f16d0b..5174b321ec 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -921,7 +921,6 @@ function wfMatchesDomainList( $url, $domains ) { * * Controlling globals: * $wgDebugLogFile - points to the log file - * $wgProfileOnly - if set, normal debug messages will not be recorded. * $wgDebugRawPage - if false, 'action=raw' hits will not result in debug output. * $wgDebugComments - if on, some debug items may appear in comments in the HTML output. * @@ -934,7 +933,7 @@ function wfMatchesDomainList( $url, $domains ) { * - false: same as 'log' */ function wfDebug( $text, $dest = 'all' ) { - global $wgDebugLogFile, $wgProfileOnly, $wgDebugRawPage, $wgDebugLogPrefix; + global $wgDebugLogFile, $wgDebugRawPage, $wgDebugLogPrefix; if ( !$wgDebugRawPage && wfIsDebugRawPage() ) { return; @@ -956,7 +955,7 @@ function wfDebug( $text, $dest = 'all' ) { MWDebug::debugMsg( $text ); } - if ( $wgDebugLogFile != '' && !$wgProfileOnly ) { + if ( $wgDebugLogFile != '' ) { # Strip unprintables; they can switch terminal modes when binary data # gets dumped, which is pretty annoying. $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1f]!', ' ', $text ); @@ -1227,8 +1226,8 @@ function wfErrorLog( $text, $file ) { * @todo document */ function wfLogProfilingData() { - global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest; - global $wgProfileLimit, $wgUser; + global $wgRequestTime, $wgDebugLogFile, $wgDebugLogGroups, $wgDebugRawPage; + global $wgProfileLimit, $wgUser, $wgRequest; StatCounter::singleton()->flush(); @@ -1249,7 +1248,17 @@ function wfLogProfilingData() { $profiler->logData(); // Check whether this should be logged in the debug file. - if ( $wgDebugLogFile == '' || ( !$wgDebugRawPage && wfIsDebugRawPage() ) ) { + if ( isset( $wgDebugLogGroups['profileoutput'] ) + && $wgDebugLogGroups['profileoutput'] === false + ) { + // Explicitely disabled + return; + } + if ( !isset( $wgDebugLogGroups['profileoutput'] ) && $wgDebugLogFile == '' ) { + // Logging not enabled; no point going further + return; + } + if ( !$wgDebugRawPage && wfIsDebugRawPage() ) { return; } @@ -1284,7 +1293,7 @@ function wfLogProfilingData() { gmdate( 'YmdHis' ), $elapsed, urldecode( $requestUrl . $forward ) ); - wfErrorLog( $log . $profiler->getOutput(), $wgDebugLogFile ); + wfDebugLog( 'profileoutput', $log . $profiler->getOutput() ); } /** diff --git a/includes/Setup.php b/includes/Setup.php index 1a7f21e8d4..e1777b1ad7 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -461,6 +461,11 @@ if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) { $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog; } +if ( $wgProfileOnly ) { + $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile; + $wgDebugLogFile = ''; +} + wfProfileOut( $fname . '-defaults2' ); wfProfileIn( $fname . '-misc1' );