Reputation: 178
During developing we met some problems with getting the real error log of the code.
nginx -> php-fpm with laravel
can't get the logs of laravel
www.conf
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
clear_env = no
catch_workers_output = yes
pm = dynamic
pm.max_children = 200
pm.start_servers = 80
pm.min_spare_servers = 50
pm.max_spare_servers = 80
pm.max_requests = 250
request_terminate_timeout = 60
slowlog = /var/log/error.log
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /usr/local/lib/session
php_value[soap.wsdl_cache_dir] = /usr/local/lib/wsdlcache
;php_value[opcache.file_cache] = /usr/local/lib/opcache
;monitoring
pm.status_path = /phpfpm_status
ping.path = /phpfpm_ping
ping.response = pong
php.ini
error_log = "/var/log/error.log"
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
display_errors = On
display_startup_errors = On
...
php-fpm.conf
include=/usr/local/etc/php-fpm.d/*.conf
[global]
error_log = "/var/log/error.log"
log_level = notice
events.mechanism = epoll
i already add full competence to the file /var/log/error.log & access.log right now,i only get php-fpm log in access.log and error.log
/var/log # cat error.log
[20-Mar-2019 06:08:34] NOTICE: fpm is running, pid 9
[20-Mar-2019 06:08:34] NOTICE: ready to handle connections
/var/log # cat access.log
172.28.0.5 - 20/Mar/2019:06:34:12 +0000 "GET /index.php" 200
172.28.0.5 - 20/Mar/2019:06:34:18 +0000 "POST /index.php" 200
/var/log # pwd
/var/log
looking for answers
Upvotes: 4
Views: 24998
Reputation: 1069
Add stderr/stdout to the logging stack in config/logging.php
This was discussed before here, and Taylor added an example to stderr output (php://stderr) in the config/logging.php shipped with laravel https://github.com/laravel/ideas/issues/126
or just change the .env LOG_CHANNEL example quoting original comment: https://github.com/laravel/ideas/issues/126#issuecomment-438548169
In recent versions (5.6+) the default config/logging.php appears to include a stderr config, so you can just inject a LOG_CHANNEL=stderr environment variable into the container.
This will redirect all error/log based on your logging level to docker logs
Upvotes: 9