Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log file is not being written in Laravel 5.5

I have logging enabled by default on Laravel 5.5.

The settings are:

In config/app.php file:

'log' => env('APP_LOG', 'single'),

'log_level' => env('APP_LOG_LEVEL', 'debug'),

In .env file:

APP_LOG_LEVEL=debug

If any error happens on the application, I can see the exception page. But I don't see it in the log file anymore. It was working fine a couple of months ago. Even when I try to log manually, it does not log it.

Log::debug('Notification');

I have code to create files using Storage and it's working fine. So, I don't think it's some permission issue. What could be the reason behind this?

like image 541
Debiprasad Avatar asked Dec 21 '19 07:12

Debiprasad


2 Answers

Try

php artisan config:cache

If the issue is related to laravel application cache, then the artisan command will help to cache all your config files ( with current changes ) into a single file. In laravel the config values are obtain from the application cache, so you've to run this command whenever you change the config files. To update the application cache with the latest changes.

If the issue is not related to application cache, you can track the real cause using the apache2 error logs.

tail -f /var/log/apache2/error.log
like image 131
Ajay Avatar answered Sep 20 '22 06:09

Ajay


Might be you have given permission and ownership to storage folder not insider folders like: taking case on redhat, because in case of redhat apache user is apache and in case of debian or most other www-data

folder | Permission | ownership 
storage | 775 | root:apache 
storage/logs | 755 | root:apache
storage/logs | 775 | root:root

It should be minimum

storage/logs | 775 | root:apache
or 
storage/logs | 755 | apache:apache

and please check once with APP_DEBUG=true

like image 40
Nitin Sharma Avatar answered Sep 20 '22 06:09

Nitin Sharma