Skip to content
Advertisement

Laravel Lumen Logging gives A facade root has not been set

I have set up the basic example of Laravel lumen with composer create-project --prefer-dist laravel/lumen demo. I am using Lumen version 8.

My .env file looks like

JavaScript

I have created a controller TrackerController and called it in routes/web.php.

JavaScript

My /app/routes/web.php looks like

JavaScript

I would like to add logging to stdout (so I can later pipe that data to Cloudwatch in AWS ElasticBeanstalk) and from what I understood, this is available out of the box, but I can’t seem to be able to get it to work.

Whenever I execute Log::info('message'); in a controller, I get a A facade root has not been set..

Without Log::info('message'); everything is working as intended.

enter image description here

Advertisement

Answer

You should make sure to uncommment the $app->withFacades() line in your bootstrap/app.php file. This method sets the application container statically on the Facade class so that each facade can use the container to resolve its ‘root’ (what the facade is the static proxy for).

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement