Disable logging in OnAfterRequest of REST API
Application Type
Traditional Web
Service Studio Version
11.10.17 (Build 41112)

Hi,

I am seeking advice on how I could get rid of some unnecessary error logs.


In the OnAfterRequest we handle an error and set the logging to false yet the error appears in Service center. How can we overcome this (see screenshot)?


NOTE: This also happens if we handle the error in a higher level and set the logging to false there too because the error is being logged in the OnAfterResponse no matter how you handle it.


Hi Recardo, 

Check the documentation

In Exception Log section-  What they have written,

Note: In the case of integrations, OutSystems logs all the exceptions independently of the value you set in the Log Error property of the Exception Handler.


 That's why  logs are appearing even after setting No at Log Error property.


Setting the Logging Level of Rest and Soap

Hope this help

Cheers

mvp_badge
MVP

Hi Recardo,

Isue with your implementation is that, after handeling the exception you are again throwing it. That is why it is again generating an exception which is logged.

Just replace that with end node and I think this will solve your problem.

Hi Ricardo,

Like Rahul Kumar said when developing integrations the log will always get logged.

You can manage the exception handling on the encapsulation action and not in the OnAfterRequest action, there the log will behave like in any other action.

Hope it helps,

Ricardo Pisco.


Thanks for the answers guys.

@Rahul Kumar thank for pointing out that it is standard behaviour.

@Nikhil Gaur that won't log indeed, the issue there is that then I can't handle the error in the encapsulation action as @Ricardo Pisco mentioned, in my case I need too.

I'll leave this thread open for now to see if anyone knows a way around it.

Hi Ricardo,

Can’t you just retrieve a customized error structure and in the action consuming the service launch the exception?

regards,

ricardo Pisco.

@Ricardo Pisco was thinking the same, it will make the code a little more complex but I don't see any other solution. I'll give it a go today. Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.