tomcat - 什么是tomcat中的localhost访问日志?

标签 tomcat

我想知道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/

相关文章:

mysql - SQLException: 找不到合适的驱动程序

java - 处理JSP页面: Neither BindingResult nor plain target object for bean name 'command' available as request attribute时出现JasperException

database - 并行运行 Tomcat 和 IIS 服务器

java - 在 rest 客户端中验证 Tomcat 身份验证

jsp - Tomcat JSP 预编译

java - 无法启动组件 [StandardEngine[Catalina].StandardHost[localhost]

angularjs - 向所有请求添加额外的 header (Angular 到 Tomcat)

java - Tomcat 不会在 Windows 中自动启动

java - Tomcat JMX 连接 - 身份验证失败

java - Eclipse Tomcat - 上下文环境变量