Skip to content

[Console] Log exit codes as debug messages instead of errors #23828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/EventListener/ErrorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event)
}

if (!$inputString = $this->getInputString($event)) {
return $this->logger->error('The console exited with code "{code}"', array('code' => $exitCode));
return $this->logger->debug('The console exited with code "{code}"', array('code' => $exitCode));
}

$this->logger->error('Command "{command}" exited with code "{code}"', array('command' => $inputString, 'code' => $exitCode));
$this->logger->debug('Command "{command}" exited with code "{code}"', array('command' => $inputString, 'code' => $exitCode));
}

public static function getSubscribedEvents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog()
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255))
;

Expand All @@ -74,7 +74,7 @@ public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog()
$logger = $this->getLogger();
$logger
->expects($this->never())
->method('error')
->method('debug')
;

$listener = new ErrorListener($logger);
Expand All @@ -97,7 +97,7 @@ public function testAllKindsOfInputCanBeLogged()
$logger = $this->getLogger();
$logger
->expects($this->exactly(3))
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run --foo=bar', 'code' => 255))
;

Expand All @@ -112,7 +112,7 @@ public function testCommandNameIsDisplayedForNonStringableInput()
$logger = $this->getLogger();
$logger
->expects($this->once())
->method('error')
->method('debug')
->with('Command "{command}" exited with code "{code}"', array('command' => 'test:run', 'code' => 255))
;

Expand Down