Jump to content

Manual talk:Structured logging

Add topic
From mediawiki.org
Latest comment: 7 years ago by BDavis (WMF) in topic Use one of the core logging channels?

Doesn't work in extensions??

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


$mylog = LoggerFactory::getInstance( "mylog" );

$mylog->debug( "Foo bar" );

>>

Fatal error: Class 'LoggerFactory' not found in .../extensions/CharInsert/CharInsert.body.php on line 15 Subfader (talk) 16:48, 17 September 2016 (UTC)Reply
Do you have a use MediaWiki\Logger\LoggerFactory; at the top of the file? Legoktm (talk) 21:09, 17 September 2016 (UTC)Reply
Thanks, that fixed it. Subfader (talk) 21:12, 18 September 2016 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Use one of the core logging channels?

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


In order to instantiate a LoggerFactory instance (when NOT coding for an extension), the manual says to "use one of the core logging channels". Is this supposed to be defined or standardized somewhere like Manual:$wgLogTypes is? Because when I search core, there are dozens of different "channels" and there doesn't seem to be any rhyme or reason to them. The manual might as well say "use any string". Greg Rundlett (talk) 05:09, 8 March 2018 (UTC)Reply

Yes, it really is basically "use any string that is configured to record debug log events to a file in your local MediaWiki deployment". There is no central codified list of widely used log channels.
For a deployment where $wgDebugLogFile logging is being used it really does not matter. For a deployment like the Wikimedia production cluster where individual log channels are selectively enabled then the choice does make a difference. When converting a wfDebugLog() call, use the same channel name. When converting a wfDebug() call, use your best judgement for selecting an existing channel or creating a new channel using an arbitrary string. BDavis (WMF) (talk) 15:55, 8 March 2018 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.