Debugging

General information

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.

Event logs

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.

Storage location of the Shopware log files

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.

Log files of extensions

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.

Activate the debug or developer mode

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

APP_ENV=prod

to

APP_ENV=dev

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.

Further Shopware independent log files

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.

Checklist

If reading the logs has not provided any information about the source of the error, the problem can be debugged in most cases using the following guide.

Deactivate extensions

The most common source of errors are extensions. Set the theme of the sales channels to the standard Shopware theme and then deactivate all third-party extensions. This can be done individually and manually via the admin or the shell, or all at once via SQL Query. 

The solution via SQL Query is more efficient as soon as a large number of extensions are installed and deactivating them would take a lot of time. We have provided instructions for deactivating third-party extensions at Shopware 6 - Tutorials & FAQs - SQL Tips & Tricks

If the problem no longer occurs after deactivating the third-party extensions, activate extensions one by one until you have found the responsible extension. You can then create a ticket for extension support in your Shopware account to directly contact the manufacturer.

Check core files

If the problem still occurs after deactivating the extensions, check the core files for correctness. Core files are/were often modified by extensions or similar.

One method for checking the files would be file-checker.php. Another method would be the FroshTools extension.

Issuetracker

If the problem does not occur in a new environment, but the above steps have not helped, it is time to create a support ticket if you have a subscription. Or if no subscription is available, use one of the following platforms:

If the above steps have not helped, but the problem can be reproduced in a new environment, it is most likely a bug in Shopware 6.

In this case, please create an issue ticket at https://issues.shopware.com/

Please use the search function in the issue tracker to check whether the same problem has already been reported.

Was this article helpful?