问题描述
我们已经接受 SS 作为我们的 REST 服务器平台并喜欢它 - 我面临的反复出现的问题之一是处理由于某种合法原因(错误、缺少强制性标头等)而短路"的日志记录请求.
We have embraced SS as our REST server platform and love it - one of the recurring issues I face deals with logging requests that have been "short circuited" for one legitimate reason or another (errors, missing mandatory headers, etc).
我发现我必须向许多不同的代码出口(即短路)点添加额外的日志代码,因为我仍然想在日志中捕获请求.我在这里做错了吗?有没有办法指定即使在短路后也会发生的强制响应过滤器".我可以看到它的多种用途,而不仅仅是记录...
I am finding that I have to add extra logging code to many different code exit (ie short circuited) points because I still want to capture the request in the logs. Am I doing something wrong here? is there a way to specify a "mandatory response filter" that occurs even after short circuiting. I could see multiple uses for this beyond just logging...
提前致谢,
乔丹
推荐答案
您可以覆盖在每个请求结束时调用的 AppHost.OnEndRequest()
.
You can override the AppHost.OnEndRequest()
which gets called at the end of each request.
这篇关于ServiceStack响应过滤器“短路"造成问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!