If shopware is operated in production mode, in most cases only general messages are issued, which do not necessarily allow you to identify the cause of an error.
However, there are some possibilities to identify the cause of the error. Often it is necessary to know the time at which an error was reported and that the error conditions are reproducible.
You can find this under Settings > System > Event Logs. A more detailed description of this programme item is available here: Detailed description of the event log.
If a customer receives the message "An error has occurred" in the storefront, the event log may contain entries that allow you to narrow down the cause. In the respective message you will find the note "Failed ..." or the word "Error". You can view the complete message by clicking on the context menu ... on the right-hand side and selecting View details.
These messages are helpful if the error is caused, for example, by the e-mail dispatch, a shipping method, incomplete data in the product, etc.
The log files created by Shopware are stored in the /var/log/ directory.
If production mode is activated in the .env file, only serious errors are logged in the prod.log.
If developer/debug mode is active, the log entries are written to the dev.log. Since all messages are stored here, this mode should only be activated if targeted debugging is necessary to avoid a large increase in log file size.
In the Shopware logs, the error type and information about the programme in which the error occurred are output. Depending on the size of the log, it simplifies the search if the approximate time at which the error occurred, the cause of which is now to be determined, is known.
In the next section we will show you how to switch between productive and developer mode.
In the /var/log/ directory you will find not only the Shopware log files but also the log files of your extensions, such as PayPal.
Please note, however, that not every extension automatically creates log files. If in doubt, it is best to contact the extension manufacturer directly.
As mentioned above, two modes can be used for logging errors. You can change the mode in the general configuration file of Shopware.
You can find the ".env" file on the web server in the Shopware main directory.
Please note that files whose file name begins with "." are hidden by default and it may be necessary to show them via a program setting, depending on the directory call.
In the file you change the line
Then it is necessary to empty the cache.
This can be done from within console by using the command.
php bin/console cache:clear
Activating the developer mode is useful if you have not found any clues when checking the event log or the Shopware logs how the error you are tracking down was triggered.
The messages in developer mode are much more detailed. Since warnings and debug messages are now also written to the log, the space required for the file is increasing. In the frontend, the mode can lead to a detailed error message being displayed instead of the shop page, partly because errors from the framework are now also listed.
We therefore recommend either activating the developer mode only for the respective debugging process or creating a test system for the evaluation. Nevertheless, even in a test system it is necessary to keep an eye on the size of the DEV.LOG, as the file grows relatively quickly and many editors can no longer open files the size of GB.
In addition to the log files provided by Shopware, it can be helpful/required to look into the access logs of the server or also into the PHP log files.
Since the locations of these log files can vary depending on the server configuration, contact your hoster on information where to find these.