use $wgDebugLogGroups to configure and wfDebugLog() to log.
* (bug 3170) Page Title failed to obey MediaWiki:Pagetitle.
wikititlesuffix was removed
* (bug 3177) Estonian date formats not implemented in LanguageEt.php
+* Add ability to break off certain debug topics into additional log files;
+ use $wgDebugLogGroups to configure and wfDebugLog() to log.
+
=== Caveats ===
$wgLogQueries = false;
$wgDebugDumpSql = false;
+/**
+ * Set to an array of log group keys to filenames.
+ * If set, wfDebugLog() output for that group will go to that file instead
+ * of the regular $wgDebugLogFile. Useful for enabling selective logging
+ * in production.
+ */
+$wgDebugLogGroups = array();
+
/**
* Whether to show "we're sorry, but there has been a database error" pages.
* Displaying errors aids in debugging, but may display information useful
}
}
+/**
+ * Send a line to a supplementary debug log file, if configured, or main debug log if not.
+ * $wgDebugLogGroups[$logGroup] should be set to a filename to send to a separate log.
+ * @param string $logGroup
+ * @param string $text
+ */
+function wfDebugLog( $logGroup, $text ) {
+ global $wgDebugLogGroups, $wgDBname;
+ if( $text{strlen( $text ) - 1} != "\n" ) $text .= "\n";
+ if( isset( $wgDebugLogGroups[$logGroup] ) ) {
+ @error_log( "$wgDBname: $text", 3, $wgDebugLogGroups[$logGroup] );
+ } else {
+ wfDebug( $text, true );
+ }
+}
+
/**
* Log for database errors
* @param string $text Database error message.
return false;
}
- #wfDebug( var_export( $loads, true ) );
+ #wfDebugLog( 'connect', var_export( $loads, true ) );
# Return a random representative of the remainder
return $this->pickRandom( $loads );
$i = $this->pickRandom( $loads );
}
}
+ $serverIndex = $i;
if ( $i !== false ) {
- wfDebug( "Using reader #$i: {$this->mServers[$i]['host']}...\n" );
+ wfDebugLog( 'connect', "Using reader #$i: {$this->mServers[$i]['host']}...\n" );
$this->openConnection( $i );
if ( !$this->isOpen( $i ) ) {
}
if ( $sleepTime ) {
$totalElapsed += $sleepTime;
+ $x = "{$this->mServers[$serverIndex]['host']} $sleepTime [$serverIndex]";
+ wfProfileIn( "$fname-sleep $x" );
usleep( $sleepTime );
+ wfProfileOut( "$fname-sleep $x" );
}
} while ( count( $loads ) && !$done && $totalElapsed / 1e6 < $wgDBClusterTimeout );