From 7065d8ae7e6a0f6804858f35b539206d72c7411a Mon Sep 17 00:00:00 2001 From: diosmosis Date: Tue, 19 Mar 2019 13:25:55 -0700 Subject: [PATCH] Make sure Monolog never adds its default handler. --- plugins/Monolog/config/config.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index b9e9e0c62ff..4d5e3d15a30 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -37,7 +37,13 @@ || \Piwik\CliMulti::isCliMultiRequest(); $writerNames = array_map('trim', $writerNames); - $writers = array(); + + $writers = [ + // we always add the null handler to make sure there is at least one handler specified. otherwise Monolog will + // add a stream handler to stderr w/ a DEBUG log level, which will cause archiving requests to fail. + $c->get(\Monolog\Handler\NullHandler::class), + ]; + foreach ($writerNames as $writerName) { if ($writerName === 'screen' && \Piwik\Common::isPhpCliMode()) { continue; // screen writer is only valid for web requests