如何使用log4net记录完整的http请求

时间:2015-06-19 19:06:33

标签: c# asp.net asp.net-mvc logging log4net

我希望能够使用我记录的每条错误消息的值记录完整的HTTP请求。目前的转换模式我看起来像这样 -

<conversionPattern value="%date{G} [%thread] %-5level
          [%aspnet-request{AUTH_USER}] [%aspnet-request{REMOTE_ADDR}] 
           %newline%message%newline
           ALL_RAW::%aspnet-request{ALL_RAW}
           %newline%newline%newline" />

这给了我一个如下的输出

06/19/2015 11:56:02 [60] INFO  [user@email.com] [mo-machine]
MESSAGE :: BOOMMMM
ALL_RAW :: Cache-Control: no-cache
Connection: keep-alive
Content-Length: 0
Content-Type: text/plain;charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Host: localhost:43899
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
CSP: active
Origin: chrome-extension://fhbjghcddcbncdddomop
Postman-Token: 38f023c1-3298-5726-e43f-650bab852cf2

URL :: POST localhost:43899 /controller/test InternalID=10124&MID=0921&Detail&OrgID=14347

我仍然错过了帖子的身体,我如何在日志中获得原始帖子的身体?有没有更好的方法来执行此操作并使用所有参数记录整个HTTP请求并正确记录正文?

0 个答案:

没有答案