phplaravellogginglaravel-5.6

Laravel 5.6 Upgrade caused Logging to break


Heey!

So I've recently been given the task to take a Laravel 5.2 up to 5.6. It seemed to be fine...until I tried to do a \Log::info(). Every time I run that, I get a big error, but at the end, it still prints to the log. I saw the 5.6 documentation on creating the config/logger.php. I took a fresh copy of it from github. The only thing I did after that was set an env variable for the LOG_CHANNEL to be single. Here's the error I get:

[2018-03-02 08:28:59] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at I:\xampp\htdocs\mtm\vendor\laravel\framework\src\Illuminate\Log\LogManager.php:181) [ ....

I did a file comparison between Laravel 5.2 and 5.6. I'm not seeing anything that jumps out that would break the Logging functionality.

Has anyone run into this with a Laravel upgrade?


Solution

  • Add this file to your config folder https://github.com/laravel/laravel/blob/5.6/config/logging.php

    and add this to your .env file LOG_CHANNEL=stack

    Don't forget to run php artisan config:clear command afterwards.