The laravel documentation indicates on the documentation that "The logger provides the seven logging levels defined in RFC 5424: debug, info, notice, warning, error, critical, and alert."
, but where should this be changed is something that is not provided. Could someone help me understand how this works and where the log level needs to be changed?
The logger provides the eight logging levels defined in RFC 5424: emergency, alert, critical, error, warning, notice, info and debug.
By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .
Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.
go to vendor->laravel->framework->src->Illuminate->Log->Writer. php and then comment out all the code within function __call like below. You log will never be save.
We can take Abishek's answer one step further. If we add the log levels to our config files, we can change the log level based on the environment we're in. In config/app.php:
'log_level' => 'debug',
and in config/prod/app.php:
'log_level' => 'warning',
We then change the daily logger to
Log::useDailyFiles(storage_path() . '/logs/' . $logFile, 0, Config::get('app.log_level'));
and we have configurable logging.
Figured it out by looking at the LogWriter Class. Not sure if this is the right approach but, there should be a config on the Laravel App that should set the Laravel Logging Level.
This is what currently needs to be done to change the logging level.
Go to app/start/global.php
(https://github.com/laravel/laravel/blob/master/app/start/global.php#L36) and on Line 36
, you would find the code
Log::useDailyFiles(storage_path().'/logs/'.$logFile);
This needs to be changed to
Log::useDailyFiles(storage_path() . '/logs/' . $logFile, 0, 'error');
The third parameter is where the log level needs to be changed and the following are the log levels that can be used
Hope this helps who ever have been searching for this. I hope there is a simpler way to do this instead of changing the function parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With