mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Log unhandled Exceptions into logfile (#1482)
* log symfony-console handled exceptions into logfile * log early bootstrap exceptions into logfile * updated CHANGELOG.md * fixed CS * try to fix php warning Declaration of Deployer\Console\Application::renderException(Exception $e, Symfony\Component\Console\Output\OutputInterface $output) should be compatible with Symfony\Component\Console\Application::renderException($e, $output) * log in TaskCommand instead of Application, to prevent x-symfony-console version issues
This commit is contained in:
parent
f4a6d99b96
commit
4b2c9fe427
@ -5,6 +5,7 @@
|
||||
|
||||
### Added
|
||||
- Added a description to the autocomplete command [#1472]
|
||||
- Log unhandled exceptions into logfile [#1481]
|
||||
|
||||
### Fixed
|
||||
- fix within() to also restore the working-path when the given callback throws a Exception [#1463]
|
||||
@ -22,7 +23,7 @@
|
||||
### Changed
|
||||
- Added support for GroupTask in invoke() [#1364]
|
||||
- Magento2 recipe optimizes the autoloader after the DI compilation [#1365]
|
||||
- Host's `roles()` API now can accept arrays too
|
||||
- Host's `roles()` API now can accept arrays too
|
||||
- Fixed bug where wrong time format is passed to touch when deploying assets [#1390]
|
||||
- Added artisan:migrate:fresh task for laravel recipe
|
||||
- Added platform config to composer.json [#1426]
|
||||
@ -39,7 +40,7 @@
|
||||
### Changed
|
||||
- Laravel version check defaults to 5.5 if not found [#1352]
|
||||
|
||||
### Fixed
|
||||
### Fixed
|
||||
- Updated Laravel recipe to not run `artisan:optimize` on Laravel >= 5.5, as that command is now deprecated ([see upgrade notes](https://laravel.com/docs/5.5/upgrade)) [#1352]
|
||||
|
||||
|
||||
@ -341,6 +342,7 @@
|
||||
- Fixed typo3 recipe
|
||||
- Fixed remove of shared dir on first deploy
|
||||
|
||||
[#1481]: https://github.com/deployphp/deployer/issues/1481
|
||||
[#1472]: https://github.com/deployphp/deployer/pull/1472
|
||||
[#1463]: https://github.com/deployphp/deployer/pull/1463
|
||||
[#1455]: https://github.com/deployphp/deployer/pull/1455
|
||||
|
@ -9,6 +9,7 @@ namespace Deployer\Console;
|
||||
|
||||
use Deployer\Component\PharUpdate\Console\Command as PharUpdateCommand;
|
||||
use Deployer\Component\PharUpdate\Console\Helper as PharUpdateHelper;
|
||||
use Deployer\Deployer;
|
||||
use Symfony\Component\Console\Application as Console;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
|
@ -141,6 +141,9 @@ class TaskCommand extends Command
|
||||
try {
|
||||
$executor->run($tasks, $hosts);
|
||||
} catch (\Throwable $exception) {
|
||||
$this->deployer->logger->log('['. get_class($exception) .'] '. $exception->getMessage());
|
||||
$this->deployer->logger->log($exception->getTraceAsString());
|
||||
|
||||
if ($exception instanceof GracefulShutdownException) {
|
||||
throw $exception;
|
||||
} else {
|
||||
|
@ -306,10 +306,13 @@ class Deployer extends Container
|
||||
$deployer = new self($console);
|
||||
|
||||
// Pretty-print uncaught exceptions in symfony-console
|
||||
set_exception_handler(function ($e) use ($input, $output) {
|
||||
set_exception_handler(function ($e) use ($input, $output, $deployer) {
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->block($e->getMessage(), get_class($e), 'fg=white;bg=red', ' ', true);
|
||||
$io->block($e->getTraceAsString());
|
||||
|
||||
$deployer->logger->log('['. get_class($e) .'] '. $e->getMessage());
|
||||
$deployer->logger->log($e->getTraceAsString());
|
||||
exit(1);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user