# Per-extension logging in MediaWiki

This is another of those things that took me rather longer to work out than I would have liked, so hopefully this'll appear in the sorts of searches I should have done.

MediaWiki has this nifty feature where you can split the logging for particular extensions out into individual files by doing things like this:

 $wgDebugLogGroups = array( 'SomeExtension' => '../logs/wiki_SomeExtension.log',);  What's not made overly clear (well, with hindsight, it is implied by the manual) is that the keys of the hash don't necessarily have anything to do with the name of the extension. I assumed that, in debugging SimpleCaptcha, what I wanted was $wgDebugLogGroups = array(        'SimpleCaptcha'     => '../logs/wiki_SimpleCaptcha.log',);

But not so! What I actually wanted was

 $wgDebugLogGroups = array( 'captcha' => '../logs/wiki_confirmedit.log',);  And, as far as I can find, this isn't documented *anywhere*. For other extensions lacking in documentation so, you can find this out by poking around in the code, and looking for where the extension does this sort of thing:  function log( <span class="katex math inline">message ) { wfDebugLog( 'captcha', 'ConfirmEdit: ' .</span>message . '; ' .$this->trigger );}

That first argument to wfDebugLog is what you want as the key in the hash. Why it can't just use the name of the class invoking it, which is the name used to configure the rest of the extension, I've no idea.