开发者

GWT RPC method name at App Engine server log

开发者 https://www.devze.com 2023-01-22 04:28 出处:网络
our project runs on GWT and Java App Engine and we use the standard GWT RPC mechanism. App engine adds log trace for each RPC call, but it just logs the servlet URL and not the called method.

our project runs on GWT and Java App Engine and we use the standard GWT RPC mechanism. App engine adds log trace for each RPC call, but it just logs the servlet URL and not the called method. We would like to add the method name to the log URL.

We have tried extending RpcRequestBuilder class, overriding doCreate and adding the method name to the URL, but开发者_开发技巧 the problem is that at this point the method name is unknown - it's known later at doSetRequestData (as part of the data string).

Thanks Itzik


In each rpc implementation you can override one of readContent and processCall and add logging.

@Override
public String processCall(String payload) throws SerializationException {
    // TODO Auto-generated method stub
    String processCall = super.processCall(payload);
    Logger.getLogger("").info(processCall);
    return processCall;
}

@Override
protected String readContent(HttpServletRequest request)
    throws ServletException, IOException {
    // TODO Auto-generated method stub
    String readContent = super.readContent(request);
    Logger.getLogger("").info(readContent);
    return readContent;
}

Log Line

6|0|4|http://127.0.0.1:8888/_4021625/|35C4974968FC8F8A9A7EA4881FD49F57|com.bitdual.client.LogMeService|logmemethod|1|2|3|4|0|

0

精彩评论

暂无评论...
验证码 换一张
取 消