group memcached debug logs
authorAntoine Musso <hashar@free.fr>
Thu, 19 Apr 2012 13:50:44 +0000 (15:50 +0200)
committerAntoine Musso <hashar@free.fr>
Thu, 19 Apr 2012 13:50:44 +0000 (15:50 +0200)
When enabling memcached debug logs ($wgMemCachedDebug), they are
unconditionally sent to the main $wgDebugLogFile.  This patch make it
possible to sent thoses specific log to an alternate file by setting
$wgDebugLogGroups['memcached']

Change-Id: I85d8ab92471ce3c31f8168dae83fe91e95e18dce

RELEASE-NOTES-1.20
includes/objectcache/MemcachedClient.php

index 3f5a314..9f9c380 100644 (file)
@@ -40,6 +40,8 @@ production.
 * (bug 27757) new API command just for retrieving tokens (not page-based)
 * Added GitViewers hook for extensions using external git repositories to have a web-based
   repository viewer linked to from Special:Version.
+* Memcached debug logs can now be sent to their own file logs by setting
+  $wgDebugLogFile['memcached'] to some filepath.
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
index 4f49f7d..2815fee 100644 (file)
@@ -1139,7 +1139,13 @@ class MWMemcached {
 // }}}
 
 class MemCachedClientforWiki extends MWMemcached {
+
        function _debugprint( $text ) {
-               wfDebug( "memcached: $text" );
+               global $wgDebugLogGroups;
+               if( !isset( $wgDebugLogGroups['memcached'] ) ) {
+                       # Prefix message since it will end up in main debug log file
+                       $text = "memcached: $text";
+               }
+               wfDebugLog( 'memcached', $text );
        }
 }