manifestor
manifestor

Reputation: 1442

Enable PHP error logging with Laravel 5.5

I can not enable PHP-FPM error logging (NGINX installation) in conjunction with Laravel 5.5 - here is what I did so far in the PHP settings:

# /etc/php/7.0/fpm/pool.d/www.conf:
catch_workers_output = yes
# /etc/php/7.0/fpm/php.ini:
log_errors = On
error_log = /var/log/php-errors.log

Then I touched /var/log/php-errors.log and made a chown www-data:www-data on it.

The strange thing is, that without Laravel, this means on other PHP framework-less installations, the above steps work, that's why I'm assuming it's some kind of Laravel setting preventing the logs to logged? I tried to produce some PHP errors in one of my controllers - but absolutely no logging to /var/log/php-errors.log. So, what am I doing wrong?

Upvotes: 2

Views: 2961

Answers (1)

Björn
Björn

Reputation: 5876

By default laravel logs to the storage/logs folder inside your project.

There are multiple logging configuration options to choose how and where to log.

In Laravel 5.5 and lower you can try setting APP_LOG in your .env file to syslog or errorlog to get them in your preferred folder.

In laravel 5.6 this is renamed to LOG_CHANNEL in your .env file.

Upvotes: 1

Related Questions