Laravel Artisan Command show verbose error messages - laravel

Typically I run a laravel artisan command like
php artisan Command -v
and if there is an error I can find the file/line#, using the -v flag.
For some reason the -v is not working on one of my commands. I am therefore receiving a pretty limited error message:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getArgument() on null
This command happens to be calling some code that is extending someone else's code.
Any ideas how to get the file/line output in the error message?

Old, but relates to a questions / answer I had...
...verbosity levels...
// -v|vv|vvv Increase the verbosity of messages:
// 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose
Good reference here...
https://github.com/JesseObrien/laravel-cheatsheet (moved to github)

It's been caught by laravel
You can dump the detail in the "handle" function in this file
/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php

Related

Laravel Schedule:list produces DateTimeZone error

Laravel Version: 8.78.1
PHP Version: 8.0.10
Description
Whilst creating my first scheduled command, trying to list my schedules with
php artisan schedule:list
throws the error:
DateTime::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, null given at vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleListCommand.php:43
changing my command to
php artisan schedule:list --timezone=Europe/London
gives:
DateTime::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, string given at vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleListCommand.php:43
Steps To Reproduce:
My schedule:
$schedule->command('email:expired-licences')->weekdays()->at('08:00');
My custom command doesn't actually do anything yet.
Eventually I found a solution if I edited ScheduleListCommand.php
changing:
->setTimezone($this->option('timezone', config('app.timezone')))
to
->setTimezone(new DateTimeZone($this->option('timezone', config('app.timezone'))))
but only if I use the --timezone=Europe/London switch (not sure if this is required), if not then the $this->option doesn't seem to be accepting the config('app.timezone') as a default.
Even:
$schedule->command('route:list')->weekdays()->at('08:00');
doesn't work on my system - not sure what's going on.
This was a bug in the laravel\framework\src\Illuminate\Console\Scheduling\ScheduleListCommand.php and was fixed in the v8.79.0 release

migration Rollback error class not found in Laravel

Trying to Rollback but its giving me error that class'task' not found. Can someone please tell me why I am getting that error,
I also tried to remove the schema drop line but still its giving the same error
In your command line run:
composer dump-autoload

php artisan migrate error in Laravel 5.3

I'm trying to create migration table in my particular path
php artisan make:migration create_options_table --create=site_options --path='Nitseditor/Nitseditor/Database'
I'm getting an error
[ErrorException]
Array to string conversion
My directory structure:
Help me out in this.
Well, it is always hard to have just Exception without knowing what file should I check and which line.
First check logs tail storage/logs/laravel.log -n 100 to get a trace of an exception thrown. There you will find the key to solve your problem. Example:
[2017-02-03 22:44:53] local.ERROR: exception 'ErrorException' with message
<message> in <path>:<line>
Stack trace: ...<details>

Where is the laravel error file located? or Is there a default error log in Laravel?

I'm working on a medium project -with laravel- for quite a long time now and of course I use the debugger of the framework -laravel-, but now from time to time I see the page of error but there is just "whoops something went wrong without" without any specifications for the error, and I see it a lot in ajax requests, but I just actualize the page and its gone!;
Finally the error show up again and I could see it in my terminal with the command tail down here
this is what I got
[2016-12-28 14:54:04] production.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in D:\shop\tess\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:45
Stack trace:
#0 D:\shop\tess\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php(25): Illuminate\Encryption\EncryptionServiceProvider->getEncrypterForKeyAndCipher(NULL, 'AES-256-CBC')
#1 D:\shop\tess\vendor\laravel\framework\src\Illuminate\Container\Container.php(731): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array)
I've found this on github it helped https://github.com/orchestral/testbench/issues/93
Make sure APP_DEBUG is set to true in your .env file
You can check the errors with the following command tail -f storage/logs/laravel.log Could be different errors

Debugging a Laravel 5 artisan migrate unexpected T_VARIABLE FatalErrorException

When running artisan migrate on a Laravel 5 project, it is failing with the following FatalErrorException:
$ artisan migrate -vvv --force
[Symfony\Component\Debug\Exception\FatalErrorException] syntax
error, unexpected '$table' (T_VARIABLE)
How do I get the file and line that is causing the error?
If in anyway relevant, I'm on a Windows 7 x64 machine with WAMP - PHP 5.6 and Laravel Framework version 5.1.10 (LTS).
There might be a semicolon or bracket missing a line
Check all in your migration files.
Laravel is configured to create daily log files for your application
which are stored in the storage/logs directory.
http://laravel.com/docs/5.1/errors#logging
This class Symfony\Component\Debug\Exception\FatalErrorException has some differences compared with the other Exception classes and it is not properly presented by the "error renderers" or "error notifiers".
A New sentry "error notifier" ("getsentry/sentry-php" version >= "2.0") will give you a proper stack trace.
Here is issue where is reported : https://github.com/getsentry/sentry-php/issues/761
Here is the PR for fix : https://github.com/getsentry/sentry-php/pull/763

Resources