Reuse and add to 500 error to get better stats from soap

落爺英雄遲暮 提交于 2020-01-05 23:25:10

问题


We deliver a huge amount of data based on soap requests. Whenever a request fails, soap specifies a 500 error must be returned with a response object telling about the error. Now I know for a fact that MANY of our responses actually should be 400 errors due to bad requests, but we are not allowed to send those. Is it possible to add something to the http log files for the 500 "I am not really a 500" errors to be picked up by Analog or other stats?

Thanks


回答1:


If you are using Apache you could use a custom log format and add a field such as:

%{Foobar}o

Where "Foobar" is the name of a header you send back in the response. Then all you need to do is add a custom header in the error response to indicate it was due to bad user input. Just be sure to start your custom header name with "X-" so that it is valid (i.e. X-Foobar)

See the mod_log_config documentation for more information about custom log formats.



来源:https://stackoverflow.com/questions/3062156/reuse-and-add-to-500-error-to-get-better-stats-from-soap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!