Consent to the use of Personal Data and Cookies

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

Disable Exceptions, such as not found, in Shopware

How to disable certain Exception error messages in Shopware, so that redundant messages do not show up in the log file.


By. Jacob

Edited: 2022-07-11 19:57

One thing I have been surprised by about Shopware, is the fact that I was getting strange error messages in my log about 404 HTTP responses, but technically these are not really errors.

For example, if a product or page is not found, then that is not really an error – it is just part of how the internet works when users request non-existent pages – you do not want to be notified about it in your error logs.

Shopware reports these as exceptions such as: NotFoundHttpException and ProductNotFoundException.

Luckily you can turn these irrelevant messages off in the config/packages/shopware.yaml file.

My shopware.yaml file now includes these rules:

            - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
            - Shopware\Core\Content\Product\Exception\ProductNotFoundException

There might be times where you want to investigate 404 errors, but mostly you can safely ignore them, because they are completely normal, and indeed, even expected.

But what about ProductNotFoundException exceptions?

Well, in my case, these seem to happen when a demo product is disabled, and as such I also do not want Shopware's log to be spammed with these messages. But, there might be cases where you do want to be notified about it, so be careful not to miss important messages. First verify the cause, then disable them in the log if you deem them redundant.

Tell us what you think:

  1. How you may be able to safely downgrade your Shopware installation in case you accidentally updated.
  2. Typical causes and solutions for the No alive nodes found in your cluster error with Elasticsearch.
  3. How to debug a problem in Shopware where getLabel() returns null instead of string.
  4. Things that might go wrong with Scheduled Tasks in Shopware.

More in: Shopware