php - Uncaught ReflectionException: Class log does not exist Laravel 5.2 -


i trying clone existing project of mine github. after clone run composer install during process receive following error:

uncaught reflectionexception: class log not exist

i running laravel 5.2 on centos 7.

i have seen references to:

  • removing spaces within .env file.
  • removing vendor directory & re-installing
  • removing packages required in composer.json

i have:

  • replaced .env example.env avoid custom config errors.
  • i have removed & re-cloned repo.
  • i have used default composer.json shipped laravel see if makes difference.

none of above have brought me joy. have same environment set on machine application working fine. difference here machine (working) wasn't cloned git - initial build environment.

the stack trace receiving:

php fatal error:  uncaught reflectionexception: class log not exist in /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php:736     stack trace:     #0 /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php(736): reflectionclass->__construct('log')     #1 /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php(631): illuminate\container\container->build('log', array)     #2 /var/www/html/acme/vendor/laravel/framework/src/illuminate/foundation/application.php(674): illuminate\container\container->make('log', array)     #3 /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php(845): illuminate\foundation\application->make('log')     #4 /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php(800): illuminate\container\container->resolveclass(object(reflectionparameter))     #5 /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php(769): illuminate\container\container->getdependenc in /var/www/html/acme/vendor/laravel/framework/src/illuminate/container/container.php on line 736 

any appreciated. in advance.

okay, after many hours of digging, solution my problem has been found. reason why problem because exception mis-leading.

uncaught reflectionexception: class log not exist

this exception means laravel tried log error couldn't instantiate laravel's log class. not due log class going walk-abouts or hiding. because laravel still going through boot process & has yet load log class.

so, exception thrown because error occurred during boot cycle of laravel - when error occurred tried throw exception - can't throw exception because log class yet loaded. hence reason reflectionexception

this has occurred in versions of laravel reason have seen exception thrown in laravel 5.1 <= because laravel silently discarded problem & carried on through boot process - basically, app still break not receive log class exception.

in particular case didn't have php-mysql extension installed causing laravel break during boot process.

ultimately, incredibly difficult debug may have done wrong due error been mis-leading.

i hope helps someone!


Comments