Tomcat日志格式自定义
<Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log."
suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
将注释去掉即可。
如果要调整日志记录的字段,需要修改pattern属性值,common是默认的属性,其值为: %h %l %u %t %r %s
%b
各符号表示为(下面描述摘自Tomcat官方文档):
%a - Remote IP address
* %A - Local
IP address
* %b - Bytes
sent, excluding HTTP headers, or '-' if zero
* %B - Bytes
sent, excluding HTTP headers
* %h -
Remote host name (or IP address if resolveHosts is false)
* %H -
Request protocol
* %l -
Remote logical username from identd (always returns '-')
* %m -
Request method (GET, POST, etc.)
* %p - Local
port on which this request was received
* %q - Query
string (prepended with a '?' if it exists)
* %r - First
line of the request (method and request URI)
* %s - HTTP
status code of the response
* %S - User
session ID
* %t - Date
and time, in Common Log Format
* %u -
Remote user that was authenticated (if any), else '-'
* %U -
Requested URL path
* %v - Local
server name
* %D - Time
taken to process the request, in millis
* %T - Time
taken to process the request, in seconds
There is also support to write information from the cookie,
incoming header,
modeled after the apache syntax:
*
%{xxx}i for incoming
headers
*
%{xxx}c for a specific
cookie
*
%{xxx}r xxx is an attribute in
the ServletRequest
*
%{xxx}s xxx is an attribute in
the HttpSession
通常情况下,为便于分析网站瓶颈,将pattern=“%h %l %u %t "%r" %s %b
%D”,其中D代表处理该请求所消耗的毫秒数,
Tomcat日志格式自定义的更多相关文章
- ELK 收集 Tomcat日志以及修改Tomcat日志格式
ELK 收集 Tomcat日志以及修改Tomcat日志格式 Tomcat日志 想要收集tomcat 日志 首先我们要对tomcat的日志有足够的了解 tomca日志分类 简单的说tomcat logs ...
- tomcat日志格式中的含义
%a - 远程IP地址 %A - 本地IP地址 %b - 发送的字节数,不包括HTTP头,或“ - ”如果没有发送字节 %B - 发送的字节数,不包括HTTP头 %h - 远程主机名 %H - 请求协 ...
- docker中tomcat日志输出自定义
一,默认tomcat日志配置文件 /data/tomcat/conf/logging.properties 1,修改tomcat/conf下的logging.properties [root@harb ...
- ELK对Tomcat日志双管齐下-告警触发/Kibana日志展示
今天我们来聊一聊Tomcat,相信大家并不陌生,tomcat是一个免费开源的web应用服务器,属于轻量级的应用程序,在小型生产环境和并发不是很高的场景下被普遍使用,同时也是开发测试JSP程序的首选.也 ...
- 在CentOS 6上使用 AWStats 分析 httpd 和 Tomcat 日志
准备工作: Awstats 是由perl语言编写的,所以要首先准备好awstats的运行环境.# yum install –y perl* Apache 一.首先,要安装apache服务器,并且启 ...
- 给Nginx配置日志格式和调整日期格式
效果对比 官方默认日志格式 # 官方默认日志格式 log_format main '$server_name $remote_addr - $remote_user [$time_local] &qu ...
- 【教程】Tomcat 的catalina.out 日志按照自定义日期格式进行切割
本文简单介绍在使用cronolog对tomcat的日志进行自定义日期格式的切割,方便日志的整理和遇到问题日志的排查! 安装cronolog 安装cronolog的方法网上有很多,这里也简单的介绍一下. ...
- ELK 之三:Kibana 使用与Tomcat、Nginx 日志格式处理
一:kibana安装: kibana主要是搜索elasticsearch的数据,并进行数据可视化的展现,新版使用nodejs. 1.下载地址: https://www.elastic.co/downl ...
- tomcat的catalina.out日志按自定义时间日式进行分割
使用cronolog对tomcat的日志进行自定义日期格式的切割,方便日志的整理和遇到问题日志的排查! 1.安装cronolog工具1.1 下载 cronolog 地址:网上很多下载地址这里就不在累赘 ...
随机推荐
- 记一次完整的pc前端整站开发
我所做的项目是一个线上的旅游平台,当然不是大家耳熟能详的那些旅游平台了,项目刚开始也没有必要去评价它的好坏,在这里我就不多说了~这是线上地址有兴趣的同学可以去看看(www.bookingctrip.c ...
- 模仿JQuery 的添加多个事件的原理
var jquery=function(dom){ var obj={ ready:function(fn){ if(typeof dom.onload=="function"){ ...
- MC34063A development aid
http://www.nomad.ee/micros/mc34063a/index.shtml This is a simple-minded design tool that allows you ...
- 用最简单的例子理解装饰器模式(Decorator Pattern)
假设有一个公司要做产品套餐,即把不同的产品组合在一起,不同的组合对应不同的价格.最终呈现出来的效果是:把产品组合的所有元素呈现出来,并显示该组合的价格. 每个产品都有名称和价格,首先设计一个关于产品的 ...
- 05引用类型以及特殊引用类型string
基本 □ 哪些属于引用类型 类(object,string),接口.数组.委托 □ 引用类型分配在哪里 ● 引用类型变量位于线程栈. ● 引用类型实例分配在托管堆上. ● 当引用类型实例的大小小于85 ...
- fundamentals5
PROTOBUF的DELPHI开源框架fundamentals5 GITHUB: https://github.com/fundamentalslib/fundamentals5 # Fundamen ...
- 【IDEA】【maven】idea使用maven插件 打包提示找不到符号找不到类,但是却没有错误
[本篇方法如果无效,请使用终极解决方法] [终极解决方法]:https://www.cnblogs.com/sxdcgaq8080/p/10117852.html 如下,在右侧maven工具中进行打包 ...
- windowsmobile 开发环境
Windows Mobile 6开发环境的配置过程 需要的文件列表:1.Visual Studio 2005 Professional及更高的版本(Visual Studio 2005 Express ...
- struts2中<welcome-file>index.action</welcome-file>直接设置action,404的解决方案
这几天的项目页面的访问全部改为.action访问,在修改首页时遇到了问题.将web.xml文件中<welcome-file>index.action</welcome-file> ...
- 文件内容操作篇clearerr fclose fdopen feof fflush fgetc fgets fileno fopen fputc fputs fread freopen fseek ftell fwrite getc getchar gets
clearerr(清除文件流的错误旗标) 相关函数 feof 表头文件 #include<stdio.h> 定义函数 void clearerr(FILE * stream); 函数说明 ...