Enhance debug log output for stacktraces
authorBryan Davis <bd808@wikimedia.org>
Mon, 24 Aug 2015 19:29:10 +0000 (13:29 -0600)
committerGergő Tisza <gtisza@wikimedia.org>
Tue, 8 Sep 2015 07:03:52 +0000 (07:03 +0000)
commitba1835f159b2a6d988a2f82a9a53d4a7ab491382
treebdd13bda2a0fa07f9a876e1f26599f2fc945de9d
parenta6016137e80e4623d1874620ac936d0703b4534f
Enhance debug log output for stacktraces

Make MediaWiki\Logger\LegacyLogger and
MediaWiki\Logger\Monolog\LineFormatter better at outputting stacktrace
information and provide support for 'exception' data in the logging
context that is a structured array in addition to the default Exception
object support. This works with MWExceptionHandler::handleFatalError
generated data that is provided by an HHVM interpreter and cannot be
delivered as an Exception class.

With this patch, a good value for LineFormatter's format would be:
"%datetime% %extra.host% %extra.wiki% %channel% %level_name%: %message%
%context% %exception%\n"

Bug: T89169
Bug: T107440
Change-Id: Ida01ed51c573e1654346e716723e543a1be63090
includes/debug/logger/LegacyLogger.php
includes/debug/logger/monolog/LineFormatter.php
includes/exception/MWExceptionHandler.php
tests/phpunit/includes/debug/logger/monolog/LineFormatterTest.php