Search code examples
shopwareshopware6shopware6-apishopware6-app

How to Log data in a SaaS Cloud Shop


As I now learned, it is not permitted by Shopware to set the permission "log_entry" and therefore use the API endpoint "api/log-entry" to add entries to the Shopware log in a SaaS Instance. :(

Would be the best solution to add an own "Log" Entity for that and provide the data to the shop owner also via an own listing view in the administration?

If so, that would be very bad, because it would be so much easier to just use the log feature Shopware already implemented.

Or is there another easier opportunity for that?

Danny


Solution

  • If you have a custom module you can use the Admin Extension SDK to dispatch a notification from within the iframe. Notifications of the error variant will also be persisted to log_entry.

    If your app is subscribing to webhooks and that's when you want to log stuff, you'll probably have to go the route you described or preferably even log on the app server. While it may be inconvenient this measure was likely taken to disencourage using the Shopware log tables because they should be reserved for errors and the likes happening within the system and should not be opened up to apps logging errors happening on their side.