-1

I've been beating my head against the problem (Laravel 5.2 on Windows 10 ...) that the php artisan command produces no output. I finally started debugging by creating an artisan2 file which prints in-progress messages, and which uses try..except to try to catch any errors. Well, first I found this:

  • php artisan2 -V ran to the point where the $kernel object tries to run the command, then quit. No exception is thrown; the program simply stops, having never returned from the method-call. But ... hallelujah! ...
  • php7 artisan2 -V produced a traceback! (The difference being PHP-5 vs. 7.)

Exception Caught! It is: 'Class log does not exist' #0 \vendor\laravel\framework\src\Illuminate\Container\Container.php(734): ReflectionClass->__construct('log') #1 \vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('log', Array) #2 \vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array) #3 \vendor\laravel\framework\src\Illuminate\Container\Container.php(849): Illuminate\Foundation\Application->make('log') #4 \vendor\laravel\framework\src\Illuminate\Container\Container.php(804): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 \vendor\laravel\framework\src\Illuminate\Container\Container.php(774): Illuminate\Container\Container->getDependencies(Array, Array) #6 \vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('App\Exceptions\...', Array) #7 \vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('App\Exceptions\...', Array) #8 \vendor\laravel\framework\src\Illuminate\Container\Container.php(230): Illuminate\Foundation\Application->make('App\Exceptions\...', Array) #9 \vendor\laravel\framework\src\Illuminate\Container\Container.php(731): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foundation\Application), Array) #10 \vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build(Object(Closure), Array) #11 \vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('Illuminate\Cont...', Array) #12 \vendor\laravel\framework\src\Illuminate\Container\Container.php(1178): Illuminate\Foundation\Application->make('Illuminate\Cont...') #13 \vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(261): Illuminate\Container\Container->offsetGet('Illuminate\Cont...') #14 \vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(117): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError)) #15 \artisan2(42): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 {main}

It looks to me like Laravel has done something to suppress error tracebacks, presumably so that it can send it to a logger ... but it can't create the logging class ... and so it doesn't produce anything at all.

Now, I don't yet know why Class log does not exist on this project, when it does exist (that is, "the artisan command runs ...") on a blank new project. I'd love for anyone to quickly tell me what the difference might be. How is this supposed to work? How does Laravel auto-construct that class?

Nevertheless, this discovery might cast some light as to why the artisan command can "exit without producing any output," as we see being reported here on SO at various times over the past few years.

Mike Robinson
  • 8,490
  • 5
  • 28
  • 41
  • I found this while searching SE and am evaluating what it says about "Class log not found." Stay tuned ... https://stackoverflow.com/questions/37759276/class-log-not-found *(But my environment isn't Lumen ...)* – Mike Robinson Dec 03 '19 at 21:24

1 Answers1

0

Well ... I never did figure out why this wasn't working for my particular (old ...) project, but I did discover that running composer install (not update) made the problem disappear. And, at this point, really the only thing that matters to me is that it finally did disappear. I really don't know what changes composer made so that, suddenly, artisan worked again.

(I also found it necessary in my environment to explicitly specify PHP-7.)

Mike Robinson
  • 8,490
  • 5
  • 28
  • 41