tomcat版本 7.0.79
1、修改tomcat的server.xml文件
配置文件139行 pattern 改为
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".log"
pattern="{"client":"%h", "client user":"%l", "authenticated":"%u", "access time":"%t", "method":"%r", "status":"%s", "send bytes":"%b", "Query?string":"%q", "partner":"%{Referer}i", "Agent version":"%{User-Agent}i"}"/>
2、取到的日志结果为:
{
"client": "192.168.1.222",
"client user": "-",
"authenticated": "-",
"access time": "[20/Aug/2018:14:44:41 +0800]",
"method": "HEAD / HTTP/1.1",
"status": "200",
"send bytes": "-",
"Query?string": "",
"partner": "-",
"Agent version": "curl/7.29.0"
}
网友评论