![](https://now.spryker.com/hubfs/98-images-used-outside-hubspot/01-Vanilla-Community/March_2025_Hackathon-Leaderboard%20728x90.jpg)
Issue Logging API Response from State Machine to CloudWatch
![emanuel.dajti](https://us.v-cdn.net/6037907/uploads/avatars/2021-02-19/n1796213152624_c75d8582ef4cc5cc9f31_original.jpg)
Hello Team,
We have several APIs integrated and are using Spryker\Shared\Log\LoggerTrait
to log request and response payloads to AWS CloudWatch. While logging works as expected for Yves and Backgw with the same configuration, we are unable to see the logs for the state machine.
For example, we are using the following code to log the response:
$this->getLogger()->info(json_encode(response));
Despite this, the logs are not appearing in CloudWatch for the state machine, though they do appear for the shop.
Has anyone encountered this issue when trying to log API request/response for state machine? Any advice on how to resolve this would be greatly appreciated.
Thank you in advance for your help!
Best regards,
Emanuel
Answers
-
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,095 ⚖️ - Guardians (admin)
Heyhey @emanuel.dajti ,
interesting question! When you talk about the State Machine you mean in general tasks which are executed in the background by jenkins, right? Because most of the OMS is done async via background tasks.
Based on my latest information jenkins is not logging to cloudwatch. Only way to see exceptions or any output is though the Jenkins UI.
All the best,
Florian
0 -
Hi @fsmeier
Thank you for your response. When I referred to the state machine, I meant the general tasks(jobs) running in the background on Jenkins—sorry for not pointing that out. We’ve actually found a way (in collaboration with Spryker colleague) to make the logs visible both in Jenkins and CloudWatch.
How this works is like following:
Scheduled jobs are wrapped by a script ( loggable.sh ). This wrapper script creates two temporary pipes which are responsible for also writing to /proc/1/fd/{1,2}, where the Cloudwatch log collector is collecting data from.
Best regards,
Emanuel
1
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 79 Spryker News
- 947 Developer Corner
- 805 Spryker Development
- 91 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 33 Product & Business Questions
- 69 Spryker Safari Questions
- 50 Random