How do I print the content of httprequest request?

后端 未结 6 455
名媛妹妹
名媛妹妹 2021-01-31 15:04

I\'ve got a bug involving httprequest, which happens sometimes, so I\'d like to log HttpGet and HttpPost request\'s content when that happens.

So, let\'s say, I create H

6条回答
  •  面向向阳花
    2021-01-31 15:45

    More details that help in logging

        String client = request.getRemoteAddr();
        logger.info("###### requested client: {} , Session ID : {} , URI :" + request.getMethod() + ":" + request.getRequestURI() + "", client, request.getSession().getId());
    
        Map params = request.getParameterMap();
        Iterator i = params.keySet().iterator();
        while (i.hasNext()) {
            String key = (String) i.next();
            String value = ((String[]) params.get(key))[0];
            logger.info("###### Request Param Name : {} , Value :  {} ", key, value);
        }
    

提交回复
热议问题