opcodesio/log-viewer

RuntimeException: A facade root has not been set. (related to log facade)

stephenstack opened this issue · 2 comments

Hi,

Odd issue. If i try to update or remove log-viewer using composer, i get the following on an autoload. Which means I'm kind of stuck. I've tried to trace the source of this, but I am getting stuck. The only thing I can find is when I dump what is being resolved in the container, the name comiing back is 'log'. What kind of conflict is going on here?

❯ composer remove opcodesio/log-viewer
./composer.json has been updated
Running composer update opcodesio/log-viewer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 1 removal

  • Removing opcodesio/log-viewer (v2.5.6)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 0 installs, 0 updates, 1 removal
  • Removing opcodesio/log-viewer (v2.5.6)
    Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:352
Stack trace:
#0 /datadisk/www/html/wwwdev/app/Exceptions/Handler.php(75): Illuminate\Support\Facades\Facade::__callStatic()
#1 /datadisk/www/html/wwwdev/app/Exceptions/Handler.php(50): App\Exceptions\Handler->sendEmail()
#2 [internal function]: App\Exceptions\Handler->App\Exceptions{closure}()
#3 /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/ReportableHandler.php(45): call_user_func()
#4 /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(299): Illuminate\Foundation\Exceptions\ReportableHandler->__invoke()
#5 /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(278): Illuminate\Foundation\Exceptions\Handler->reportThrowable()
#6 /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(523): Illuminate\Foundation\Exceptions\Handler->report()
#7 /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(203): Illuminate\Foundation\Console\Kernel->reportException()
#8 /datadisk/www/html/wwwdev/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#9 {main}
thrown in /datadisk/www/html/wwwdev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 352
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

Update: i found I had to remove the log-viewer.php form the configs directory. To get back and working.

In errors like this, the problem is something with the configuration files, yes. E.g. a config file uses a class that's not defined any more (after uninstalling a package) or has some sort of error when executing.

In this case, Log Viewer v2 was using Opcodes\LogViewer\Level::caseValues() inside the config, a class which was no longer available and thus threw an exception.

This was removed in later versions and is no longer the case. When upgrading to a newer Log Viewer version, make sure to also update the config file 😄

Closing this as the issue is related to an older version. I can't change/fix it on v2 because that would be a breaking change unfortunately. Log Viewer v3 does not have this issue.