diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-22 00:10:57 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-22 00:11:33 +0300 |
commit | 3dc9bd3cae1250980e62a0ccfec7c39332fbd64b (patch) | |
tree | 70544e7bd490f583a6a2cade4cda024daa57f05c /core | |
parent | 5bc86c2e9a9baf5ac227fb87ea25847f7a5067dd (diff) |
#6881 Disable logging in 'climulti:request'
Logging in `climulti:request` can mess up `core:archive`.
Diffstat (limited to 'core')
-rw-r--r-- | core/CliMulti/RequestCommand.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/CliMulti/RequestCommand.php b/core/CliMulti/RequestCommand.php index 4eddb0d8b8..74f4d9f6d0 100644 --- a/core/CliMulti/RequestCommand.php +++ b/core/CliMulti/RequestCommand.php @@ -9,12 +9,13 @@ namespace Piwik\CliMulti; use Piwik\Config; +use Piwik\Container\StaticContainer; use Piwik\Plugin\ConsoleCommand; use Piwik\Url; use Piwik\UrlHelper; +use Psr\Log\NullLogger; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** @@ -31,6 +32,8 @@ class RequestCommand extends ConsoleCommand protected function execute(InputInterface $input, OutputInterface $output) { + $this->disableLogging(); + $this->initHostAndQueryString($input); if ($this->isTestModeEnabled()) { @@ -81,4 +84,13 @@ class RequestCommand extends ConsoleCommand } } -}
\ No newline at end of file + /** + * We need to disable logging for this command because the command output is the HTTP output of + * the HTTP request we are simulating here (so we don't want logs to mess it up). + */ + private function disableLogging() + { + $container = StaticContainer::getContainer(); + $container->set('Psr\Log\LoggerInterface', new NullLogger()); + } +} |