---
title: "tomcat格式化配置访问日志"
author: "aooboo"
date: "2010-09-19T23:36:52Z"
tags: ["Apache", "C", "C#", "C++", "Tomcat"]
categories: ["互联网"]
slug: "tomcat"
draft: false
lastmod: "2010-09-19T23:36:52Z"
id: 767695
url: "https://aooboo.iteye.com/blog/767695"
---

\[code="java"] \[/code] tomcat 格式化访问日志，而且可以从header、session中取值，很爽，节约大量的统计工作！ 摘录官方网站一段： There is also support to write information from the cookie, incoming header, the Session or something else in the ServletRequest. It is modeled after the apache syntax: * %{xxx}i for incoming headers * %{xxx}o for outgoing response 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 官方文档页面：http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html