Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handling Log #3071

Open
vietcuongwork opened this issue Aug 20, 2024 · 0 comments
Open

Error Handling Log #3071

vietcuongwork opened this issue Aug 20, 2024 · 0 comments

Comments

@vietcuongwork
Copy link

vietcuongwork commented Aug 20, 2024

Description

Hello,

I am using WSO2 API Manager 3.2.0 and would like to know if it is possible to configure the system to log all error responses sent back to the client in the event of an error. My goal is to capture these error responses and output them to an external database for improved supervision of error handling.

For reference, I am looking to log errors similar to those outlined in the WSO2 documentation on Error Handling. Below is an example of an error response I wish to log:
<am:fault xmlns:am="http://wso2.org/apimanager"> <am:code>700700</am:code> <am:message>API blocked</am:message> <am:description>This API has been blocked temporarily. Please try again later or contact the system administrators.</am:description> </am:fault>

I attempted to add logging to the fault.xml file located in WSO2\API Manager\3.2.0\repository\deployment\server\synapse-configs\default\sequences, as I understand this is the primary fault sequence invoked when an error occurs during the execution of API resources. My expectation was that all errors would eventually pass through this sequence before the response is constructed and sent back to the client.

However, I have observed that not all errors are handled in this manner. For instance, when I change the state of a deployed API to "blocked," a new XML file is created in WSO2\API Manager\3.2.0\repository\deployment\server\synapse-configs\default\api. Even if I modify this file, the changes revert to the original configuration when I redeploy and block the API again.

Could you please advise on how I can ensure that all error responses, including those related to API state changes, are logged consistently to the Carbon console and subsequently to an external database?

Thank you for your assistance.

Affected Component

APIM

Version

3.2.0

Related Issues

No response

Suggested Labels

wso2apim, errorhandling, logmediator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant