tomcat access log pattern
来源:互联网 发布:淘宝号星级怎么算的 编辑:程序博客网 时间:2024/05/24 06:42
- %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
- %I - Current request thread name (can compare later with stacktraces)
http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html
[Date and time] [Remote IP] [Bytes sent] [Request method] [HTTP status code of the response] [Time taken in millis] [User session ID] [Current request thread name]
%t [%a] [%b] [%m] [%s] [%D] [%S] [%I] [%H://%v%U%q]
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%t [%a] [%b] [%m] [%s] [%D] [%S] [%I] [%H://%v%U%q]" />
proxy:
pattern: %{X-Forwarded-For}
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%{X-Forwarded-For} i %t [%a] [%b] [%m] [%s] [%D] [%S] [%I] [%H://%v%U%q]" />
http://www.docjar.org/docs/api/org/apache/catalina/valves/AccessLogValve.html
org.apache.catalina.valves
public class: AccessLogValve [javadoc | source]
java.lang.Object org.apache.catalina.valves.ValveBase org.apache.catalina.valves.AccessLogValve
All Implemented Interfaces:
Lifecycle, Valve, MBeanRegistration, Contained
Direct Known Subclasses:
FastCommonAccessLogValve, ExtendedAccessLogValve
Implementation of the Valve interface that generates a web server access log with the detailed line contents matching a configurable pattern. The syntax of the available patterns is similar to that supported by the Apachemod_log_config
module. As an additional feature, automatic rollover of log files when the date changes is also supported.
Patterns for the logged message may include constant text or any of the following replacement strings, for which the corresponding information from the specified Response is substituted:
- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name
- %H - Request protocol
- %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %p - Local port
- %q - Query string (prepended with a '?' if it exists, otherwise an empty string
- %r - First line of the request
- %s - HTTP status code of the response
- %S - User session ID
- %t - Date and time, in Common Log Format format
- %u - Remote user that was authenticated
- %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
- %I - current Request thread name (can compare later with stacktraces)
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
- common -
%h %l %u %t "%r" %s %b
- combined -
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"
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
Conditional logging is also supported. This can be done with the condition
property. If the value returned from ServletRequest.getAttribute(condition) yields a non-null value. The logging will be skipped.
- author:
Craig
- R. McClanahan - author:
Jason
- Brittain - author:
Remy
- Maucherat - author:
Takayuki
- Kaneko - author:
Peter
- Rossbach - version:
$
- Revision: 832123 $ $Date: 2009-11-02 22:57:21 +0100 (Mon, 02 Nov 2009) $
public void addLifecycleListener(LifecycleListener listener)
- Add a lifecycle event listener to this component.
public void backgroundProcess()
- Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.
protected AccessLogElement[] createLogElements()
- parse pattern string and create the array of AccessLogElement
public LifecycleListener[] findLifecycleListeners()
- Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.
public String getCondition()
- Return whether the attribute name to look for when performing conditional loggging. If null, every request is logged.
public String getDirectory()
- Return the directory in which we create log files.
public boolean getEnabled()
public String getFileDateFormat()
- Return the date format date based log rotation.
public String getInfo()
- Return descriptive information about this implementation.
public String getPattern()
- Return the format pattern.
public String getPrefix()
- Return the log file prefix.
public String getSuffix()
- Return the log file suffix.
public void invoke(Request request, Response response) throws IOException, ServletException
- Log a message summarizing the specified request and response, according to the format specified by the
pattern
property.public boolean isBuffered()
- Is the logging buffered
public boolean isCheckExists()
- Check for file existence before logging.
public boolean isResolveHosts()
- Get the value of the resolve hosts flag.
public boolean isRotatable()
- Should we rotate the logs
public void log(String message)
- Log the specified message to the log file, switching files if the date has changed since the previous log call.
protected synchronized void open()
- Open the new log file for the date specified by
dateStamp
.public void removeLifecycleListener(LifecycleListener listener)
- Remove a lifecycle event listener from this component.
public synchronized boolean rotate(String newFileName)
- Rename the existing log file to something else. Then open the old log file name up once again. Intended to be called by a JMX agent.
public void setBuffered(boolean buffered)
- Set the value if the logging should be buffered
public void setCheckExists(boolean checkExists)
- Set whether to check for log file existence before logging.
public void setCondition(String condition)
- Set the ServletRequest.attribute to look for to perform conditional logging. Set to null to log everything.
public void setDirectory(String directory)
- Set the directory in which we create log files.
public void setEnabled(boolean enabled)
public void setFileDateFormat(String fileDateFormat)
- Set the date format date based log rotation.
public void setPattern(String pattern)
- Set the format pattern, first translating any recognized alias.
public void setPrefix(String prefix)
- Set the log file prefix.
public void setResolveHosts(boolean resolveHosts)
- Set the resolve hosts flag.
public void setRotatable(boolean rotatable)
- Set the value is we should we rotate the logs
public void setSuffix(String suffix)
- Set the log file suffix.
public void start() throws LifecycleException
- Prepare for the beginning of active use of the public methods of this component. This method should be called after
configure()
, and before any of the public methods of the component are utilized.public void stop() throws LifecycleException
- Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
- tomcat access log pattern
- tomcat access log
- Tomcat access log配置
- tomcat 中配置 access log
- tomcat access log格式配置
- Access Log Sampler读取tomcat log
- Tomcat的access log的设置
- tomcat Access Log 统计相应时间
- Tomcat Access Log记录X-Forwarded-For
- tomcat Access Log 统计相应时间
- failed to open access log file D:\my11\taotao-manage-web\target\tomcat\logs\access.log
- Access Log
- 修改Tomcat的Access Log存放路径和文件名
- 通过Nginx,Tomcat访问日志(access log)记录请求耗时
- 通过Nginx,Tomcat访问日志(access log)记录请求耗时
- tomcat log
- resin access log 格式
- jboss access log config
- no suitable driver found for jdbc:mysql//localhost:3306/..
- 第九周项目五——程序填充题(2)
- C++隐式类类型转换
- OVS+openflow+KVM
- 网络流之 最短增广路算法模板(SAP)
- tomcat access log pattern
- NSCharacterSet 简单用法
- C# 将MSMQ消息转换成Json格式 【优化】
- c# 未能加载文件或程序集
- 程序实践系列(八)继承与派生
- flex返回一条数据无法显示的问题
- 当return遇到finally
- 数据库--学习笔记2
- 第9周项目3-输出星号图e