Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wturrell's avatar

Error when upgrading to 5.2 - 'Class log does not exist'

I believe I've corrected followed the upgrade instructions, but when I run 'composer update' I get the following (and the same error for any subsequent page views or artisan commands.)

(This is a very basic application that doesn't use auth, ORM, a database etc.)

Any ideas?

Thanks…

> php artisan optimize
PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:736
Stack trace:
#0 /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(736): ReflectionClass->__construct('log')
#1 /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('log', Array)
#2 /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array)
#3 /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): Illuminate\Foundation\Application->make('Psr\\Log\\LoggerI...')
#4 /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 /home/vagrant in /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 736

Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 736

ReflectionException: Class log does not exist in /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 736

Call Stack:
    0.0003     226264   1. {main}() /home/vagrant/homestead/rssmaker/artisan:0
    0.1202    2076480   2. Illuminate\Foundation\Console\Kernel->handle() /home/vagrant/homestead/rssmaker/artisan:36
    0.1818    2652720   3. Illuminate\Foundation\Console\Kernel->reportException() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:109
    0.1818    2652768   4. Illuminate\Container\Container->offsetGet() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:250
    0.1818    2652768   5. Illuminate\Foundation\Application->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:1168
    0.1818    2652904   6. Illuminate\Container\Container->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
    0.1818    2653016   7. Illuminate\Container\Container->build() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
    0.1818    2653016   8. Illuminate\Container\Container->Illuminate\Container{closure}() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:733
    0.1818    2653064   9. Illuminate\Foundation\Application->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:230
    0.1818    2653064  10. Illuminate\Container\Container->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
    0.1818    2653152  11. Illuminate\Container\Container->build() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
    0.1892    2701968  12. Illuminate\Container\Container->getDependencies() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:771
    0.1926    2716056  13. Illuminate\Container\Container->resolveClass() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:800
    0.1926    2716144  14. Illuminate\Foundation\Application->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:845
    0.1926    2716280  15. Illuminate\Container\Container->make() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
    0.1927    2716360  16. Illuminate\Container\Container->build() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
    0.1927    2716576  17. ReflectionClass->__construct() /home/vagrant/homestead/rssmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php:736

Script php artisan optimize handling the post-update-cmd event returned with an error
0 likes
27 replies
adaptivemedia's avatar

Have you tried manually deleting the bootstrap/compiled.php file?

1 like
bashy's avatar
bashy
Best Answer
Level 65

Edit;

Some people don't seem to understand how vars work and add spaces without adding double quotes for some reason.

Wrong

SOME_VAR=some value

Correct

MY_VAR="some value"

Have you tested a fresh install?

Looking at your error message, it has a lowercase L for log. Class log does not exist It may mean you have something which is referencing log instead of Log. Check all configs etc and compare to the master branch https://github.com/laravel/laravel

4 likes
wturrell's avatar

@bashy Thanks for recommending config files. The fix was in config/app.php replacing:

'rss_output_dir' => $app->environment('production') ? '/var/www/foo/public' : '/home/vagrant/homestead/foo/public',

with:

'rss_output_dir' => 'production' === env('APP_ENV') ? '/var/www/foo/public' : '/home/vagrant/homestead/foo/public',

(I'm using this because I found, like other people, that extending the configuration by adding a subdirectory with the environment name under /config/ didn't (or no longer) worked.)

skovmand's avatar

I also had the problem. In the end I debugged it from the console by running php artisan and tracing the execution path step by step inside PHPStorm from the artisan.php-file in the project root. I did it simply by putting in the good old dd('here'); to see where the execution would stop.

I debugged it like this: In the file /vendor/laravel/framework/src/Illuminate/Foundation/Application.php I changed the method bootstrapWith to

    public function bootstrapWith(array $bootstrappers)
    {
        $this->hasBeenBootstrapped = true;

        foreach ($bootstrappers as $bootstrapper) {
            var_dump('bootstrapping: ' . $bootstrapper);
            $this['events']->fire('bootstrapping: '.$bootstrapper, [$this]);

            $this->make($bootstrapper)->bootstrap($this);

            var_dump('bootstrapped: ' . $bootstrapper);
            $this['events']->fire('bootstrapped: '.$bootstrapper, [$this]);
        }
    }

And ran php artisan again from the terminal. The last provider that started loading (but didn't finish) was LoadConfiguration provider. It gave me a clue where to look.

And so I changed the file /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php in the method loadConfigurationFiles to:

    protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
    {
        foreach ($this->getConfigurationFiles($app) as $key => $path) {
            $repository->set($key, require $path);
            var_dump('loaded key: ' . $key . ' -- path: ' . $path);
        }
    }

After which it was clear that the last configuration key loaded was /config/queue.php string(87) "loaded key: queue -- path: /home/vagrant/Code/traeningsprojekt.dk/site/config/queue.php"

So it must be the file after that. And it was indeed - in my /config/services.php where I had the array key:

    // One key is for testing (doesn't send any actual mail), the other for real mails.
    'mandrill' => [
        'secret' => app()->environment() === 'testing' ? 'hidden-in-this-post' : 'also-hidden-in-this-post'
    ],

Phew what a journey. But in the end I solved it, and it was indeed a configuration issue.

OH! And DO remember to undo the two changes to the Illuminate files when you are done :-)

3 likes
Garfild's avatar

For me everything was so much easier but however stupid. :) I just forgot to write quotes around params in .env file ,that contains Space.

So it was like:

SITE_NAME = My SIte Name

But of course has to be

SITE_NAME = "My Site Name"

This was the error-causing stuff. :)

4 likes
ixmanuel's avatar

@ Garfild — observation works for me. In 5.1 works fine values without quotes but not anymore in 5.2

gocanto's avatar

I have an fresh install and facing the same issue right now! any clue? I understand that there is a problem with log class, but what I do not get it is where this is happening exactly!

XenitXTD's avatar

Hey Guys, I had a similar issue to this

I found that this was because i had a password for my email provider that had a space in it so i just put the password in 'xyz abc' and this resolved it for me... This was in the 'env' file which is referenced in the mail providers file

Apparently spaces are not welcome... its not nice when the errors are not so descriptive

1 like
gocanto's avatar

testing an new installation and having the same issue... any clue?

[04-Feb-2016 20:43:08 UTC] PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace: #0 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): ReflectionClass->__construct('log') #1 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('log', Array) #2 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array) #3 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php(853): Illuminate\Foundation\Application->make('Psr\Log\LoggerI...') #4 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php(808): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php(779): I in /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 738 [04-Feb-2016 20:44:26 UTC] PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /home/gocanto/loans/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace:

gocanto's avatar

I have the app running on http://g-ocanto.com/loans/

I have tried everything I have could and nothing yet. Also, I went through all the config files and see if I had something different but still

Thanks!

pakuize's avatar

This thread helped me out a great deal thanks everyone in here.

m.talaye's avatar

Hi,

Did you check that PDO PHP Extension installed? I had the same issue and it is fixed after installing PDO extension.

2 likes
krishna's avatar

Hi ,

can anyone help me out this error

root@gitlab:/var/www/project# php artisan vendor:publish --provider="Monarkee\Bumble\Providers\BumbleServiceProvider" --tag="config" PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Console\Kernel does not exist' in /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:741 Stack trace: #0 /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(741): ReflectionClass->__construct('App\Console\Ker...') #1 /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('App\Console\Ker...', Array) #2 /var/www/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('App\Console\Ker...', Array) #3 /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(220): Illuminate\Foundation\Application->make('App\Console\Ker...', Array) #4 /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foundation\Application), Array) #5 /var/ in /var/www/project/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 741 root@gitlab:/var/www/project#

orrd's avatar

Thanks for the hint to check for errors in the .env file. For me, it was a like with an empty value, just "foo=". That used to work in earlier versions of DotEnv, but apparently no longer does.

I'm not sure why the "log" error is the error that displays when there is a problem with the .env file, but something should be changed to make it display a more relevant error message.

idontmessabout's avatar

Fell fowl of the same thing recently when updating some older projects; no quotes around .env variables with spaces.

1 like
jhmilan's avatar

Hi,

Just my 2 cents here. Go through your .env file and double-check that any string value with white-spaces is in quotes. e.g.:

MY_VAR=some value <-- bad

MY_VAR="some value" <-- good

it drove me crazy for 1 hours to realize about it. Just guessing, but it looks like the .env validation fails during the config load and (likely) a log line is written somewhere, BUT the Log facade is still not loaded which causes a crash.

dkthelearner's avatar

Hii,

This error occurred because special character and space in .env file.

Hamelraj's avatar

I hosted my application on shared hosting (BLUE HOST) suddenly i got error ; like this https://drive.google.com/open?id=0ByoLPyyQ3jAjZUFrRDk1ZGRLQVk

so i download my application run on my local host im getting this error

Fatal error: Uncaught ReflectionException: Class log does not exist in C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:738 Stack trace: #0 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(738): ReflectionClass->__construct('log') #1 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(633): Illuminate\Container\Container->build('log', Array) #2 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array) #3 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(853): Illuminate\Foundation\Application->make('log') #4 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(808): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Containe in C:\xampp\htdocs\ums\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 738

can any one give idea ???? why is that ???

mmickelson's avatar

After many frustrating hours, the solution I found was to use env('APP_ENV') instead of App::environment(). In my config/services.php:

// credentials for loggly.com
'loggly' => [
    'key'   => '18f2blah_blah_blah',
    'tag'   => 'MyProject_'.env('APP_ENV'), // .strtolower(App::environment()) causes a reflection error about class log
],
projectmentor's avatar

Hi, Just just ran into the same error on a 5.2 project. I forgot to type the ::class static modifier after I updated the config/app.php with a new service provider.

e.g:

'providers' => [
 ...
MyVendor\MyServiceProvider
...
];

should be:

'providers' => [
 ...
MyVendor\MyServiceProvider::class
...
];

HTH

Please or to participate in this conversation.