Question

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.

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top