请求调试信息,我发现它非常有用做的Django/Python的web开发时全面检查这样的HTTP请求:印刷上的Java Servlet
logger = logging.getLogger(__name__)
def index(request):
logger.info(request)
是否有类似的Java Servlet的东西吗?
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// debugInfo should print something similar to what you get in DJANGO
debugInfo(request);
}
可以肯定,它在标准控制台中结束? (因此不在HTTP响应中,尽管您没有通过该方法传递'response') – BalusC
它会在记录器配置为结束的任何地方结束。但没关系。如果它生成一个我可以在其他地方打印的字符串,我将会非常高兴。 –
对啊,你基本上是在寻找一个'HttpServletRequestWrapper'实现,它返回一个多行'String',其中包含'toString()'调用的所有调试信息?对不起,没有人想到。 – BalusC