Magento2 Multistore Separate Logging Question
-
15-04-2021 - |
Pregunta
Is there a way to enable separate logs for each store within my Magento 2.3 set up? I am having difficulties when searching through the logs for issues pertaining to specific stores.
Solución
You can separate Apache/Nginx logs based on virtual host by using multiple Virtual Host definitions, one for each domain, and then send the error / access logs to separate items. For example:
server {
server_name store1.magento.dev;
root /var/www/magento/pub;
access_log /var/www/magento/var/nginx_access.log combined;
error_log /var/www/magento/var/nginx_error.log;
# [...]
}
server {
server_name store2.magento.dev;
root /var/www/magento/pub;
access_log /var/www/magento/var/nginx_access.log combined;
error_log /var/www/magento/var/nginx_error.log;
# [...]
}
As for the Magento logs, I don't believe that's possible as it's one "system" that is being logged. Only way I could think to do this would be to have multiple "installations" on the server, and set your webserver to use one "installation" per site. For example: /var/www/magento/store1
and /var/www/magento/store2
would have the same codebase checked out and store1.magento.dev
and store2.magento.dev
point to the same folders. This would effectively split all logs by store (except webserver access/error logs).