简体   繁体   English

如何为对我的API的每个REST调用启用日志记录?

[英]How do I enable logging for each REST call to my API?

I'm trying to test out my API in WSO2 API Manager. 我正在尝试在WSO2 API管理器中测试我的API。 I've gone to the API Store, logged in as a regular client user, subscribed to the API, and now I'm trying to test it using the API Console. 我去过API商店,以普通的客户端用户身份登录,订阅了API,现在我正尝试使用API​​控制台对其进行测试。 I can see the API just fine, and I'm clicking the "try it out" button. 我可以看到API很好,然后单击“试用”按钮。 Unfortunately, for all of my API calls, I just get the progress meter going on forever (the "....." thing on the right). 不幸的是,对于我所有的API调用,我只是使进度表一直运行(在右边的“ .....”东西)。 It never completes. 它永远不会完成。

There is nothing in the logs that indicates what is going wrong. 日志中没有任何内容指示出问题所在。 I have tried turning a ton of different settings in the log4j.properties file to TRACE or DEBUG, and I'm still getting nothing. 我尝试将log4j.properties文件中的大量不同设置转换为TRACE或DEBUG,但仍然无济于事。

I think I'm asking something very basic, but there seems to be no information about it anywhere: How do I just get the product to log when a REST message comes in to the gateway, and log the HTTP it is trying to send to my REST API? 我想我要问的是一个非常基本的问题,但是似乎在任何地方都没有关于它的信息:当REST消息进入网关时,如何使产品记录下来,并记录它试图发送到的HTTP 我的 REST API? I'm sure if I could get that showing in a log, then I could probably figure out what is going wrong. 我确定如果可以在日志中显示该信息,那么我可能可以找出问题所在。

Here's how you do it in API Cloud (hosted version of API Manager): http://wso2.com/blogs/cloud/trace-api-calls-and-responses/ - I assume that the same mediation sequences are in the latest version of the product too. API Cloud (API管理器的托管版本)中的操作方法如下: http : //wso2.com/blogs/cloud/trace-api-calls-and-responses/-我假定最新的中介顺序相同产品的版本。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM