php - How can I display Exception trace in laravel console command? -


i'm using laravel 5.1 create console based application. during development display exception trace when error occurs. however, if use -v -vv or -vvv option in php artisan, don't exception trace custom commands. set app_debug=true in .env, still no exception trace.

output of php artisan some:unknowncommand is:

[invalidargumentexception]                               there no commands defined in "some" namespace. 

output of php artisan -v some:unknowncommand is:

[invalidargumentexception]                                 there no commands defined in "some" namespace.    exception trace:  () @ /users/dirkpostma/dropbox/domains/dpepp/vendor/symfony/console/application.php:501  symfony\component\console\application->findnamespace() @ /users/dirkpostma/dropbox/domains/dpepp/vendor/symfony/console/application.php:535  symfony\component\console\application->find() @ /users/dirkpostma/dropbox/domains/dpepp/vendor/symfony/console/application.php:192  symfony\component\console\application->dorun() @ /users/dirkpostma/dropbox/domains/dpepp/vendor/symfony/console/application.php:126 ... 

now, created simple console command called dp:test, following handle function:

/**  * execute console command.  *  * @return mixed  */ public function handle() {     generate error here } 

output of php artisan dp:test is:

[symfony\component\debug\exception\fatalerrorexception] syntax error, unexpected 'error' (t_string)     

output of php artisan -v dp:test same. output of php artisan -vvv dp:test same.

the log file show exception trace, somehow should possible display in cli. don't see filename , linenumer error occurs... how can take care of this?

thanks in advance!

edit:

is digged bit further. in case use in command:

public function handle() {     throw new \exception("test exception"); } 

and issue command php artisan -v dp:test, error trace printed. trace not printed when exception thrown due php error. in illuminate/foundation/bootstrap/handleexceptions.php method bootstrap php errors converted exceptions. when occurs, exception thrown, -v somehow ignored when printing. inconvenient because makes debugging cli apps hard.

i think solution can found in vendor/symfony/console/application.php, method renderexception.

i'm going dig further later, unless else can point solution faster me :-)

i found reason why -v ignored:

in illuminate/foundation/bootstrap/handleexceptions.php, renderforconsole methode instantiates consoleoutput object, default settings, not taking account verbosity settings user asked for:

protected function renderforconsole($e) {     $this->getexceptionhandler()->renderforconsole(new consoleoutput, $e); } 

for reason, whatever -v -vv or -vvv set, $output->getverbosity() in vendor/symfony/console/application.php lower outputinterface::verbosity_verbose, reason, stack trace not printed.

i start issue on github this, because think it's more convenient if errors shown in cli if user sets -v.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -