我想知道tomcat中的本地主机访问日志是什么?我们可以通过这些日志监控哪些信息以及如何通过Java程序读取它们?
最佳答案
访问日志包含每个到达服务器的请求的信息。它可用于跟踪页面点击次数、用户 session 事件等,因为它会记录所有传入请求以及时间戳、请求 HTTP 方法和 HTTP 响应代码。
示例日志语句如下
46.181.252.151 - - [22/Feb/2019:19:04:19 +0000] "GET /task/768476366 HTTP/1.1" 200 6765
36.231.298.259 - - [22/Feb/2019:19:04:20 +0000] "GET /doc/wallet/9855563 HTTP/1.1" 200 45564
通用日志记录模式 ="%h %l %u %t "%r"%s %b"
%h – Remote hostname (or IP address if the resolveHosts attribute is set to false; by default the value is false).
%l – Remote logical user name; this is always a hyphen (-).
%u – Remote user that has been authenticated. In the example, “admin” and a hyphen (-). If there is none, it’s a hyphen (-).
%t – Date and time in common log file format.
%r – The first line of the request. In the example, “GET / HTTP/1.1” (note that this is configured to be shown within quotes (“”)).
%s – The HTTP status code of the response. In the example 200 is the OK status.
%b – Bytes sent count, excluding HTTP headers, and shows a hyphen (-) if zero.
更多详情 click here
关于tomcat - 什么是tomcat中的localhost访问日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20784453/