Top Description Fields Methods
org.apache.catalina

public Interface AccessLog

Known Direct Implementers
org.apache.catalina.core.AccessLogAdapter, org.apache.catalina.core.StandardEngine.NoopAccessLog, org.apache.catalina.valves.AbstractAccessLogValve, org.apache.catalina.valves.JDBCAccessLogValve
Imports
org.apache.catalina.connector.Request, .Response

Intended for use by a Valve to indicate that the Valve provides access logging. It is used by the Tomcat internals to identify a Valve that logs access requests so requests that are rejected earlier in the processing chain can still be added to the access log. Implementations of this interface should be robust against the provided Request and Response objects being null, having null attributes or any other 'oddness' that may result from attempting to log a request that was almost certainly rejected because it was mal-formed.

Field Summary

Modifier and TypeField and Description
public static final String
PROTOCOL_ATTRIBUTE

Name of request attribute used to override the protocol recorded by the AccessLog.

public static final String
REMOTE_ADDR_ATTRIBUTE

Name of request attribute used to override the remote address recorded by the AccessLog.

public static final String
REMOTE_HOST_ATTRIBUTE

Name of request attribute used to override remote host name recorded by the AccessLog.

public static final String
SERVER_NAME_ATTRIBUTE

Name of request attribute used to override the server name recorded by the AccessLog.

public static final String
SERVER_PORT_ATTRIBUTE

Name of request attribute used to override the server port recorded by the AccessLog.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the attributes will be logged, otherwise false
getRequestAttributesEnabled
()

public void
log(Request
Request (associated with the response) to log
request
,
Response
Response (associated with the request) to log
response
,
long
Time taken to process the request/response in nanoseconds (use 0 if not known); in Tomcat versions prior to 10, the time unit was milliseconds
time
)

Add the request/response to the access log using the specified processing time.

public void
setRequestAttributesEnabled(boolean
true causes the attributes to be used, false causes the original values to be used.
requestAttributesEnabled
)

Should this valve use request attributes for IP address, hostname, protocol and port used for the request?

Field Detail

PROTOCOL_ATTRIBUTEback to summary
public static final String PROTOCOL_ATTRIBUTE

Name of request attribute used to override the protocol recorded by the AccessLog.

REMOTE_ADDR_ATTRIBUTEback to summary
public static final String REMOTE_ADDR_ATTRIBUTE

Name of request attribute used to override the remote address recorded by the AccessLog.

REMOTE_HOST_ATTRIBUTEback to summary
public static final String REMOTE_HOST_ATTRIBUTE

Name of request attribute used to override remote host name recorded by the AccessLog.

SERVER_NAME_ATTRIBUTEback to summary
public static final String SERVER_NAME_ATTRIBUTE

Name of request attribute used to override the server name recorded by the AccessLog.

SERVER_PORT_ATTRIBUTEback to summary
public static final String SERVER_PORT_ATTRIBUTE

Name of request attribute used to override the server port recorded by the AccessLog.

Method Detail

getRequestAttributesEnabledback to summary
public boolean getRequestAttributesEnabled()
Returns:boolean

true if the attributes will be logged, otherwise false

See Also
setRequestAttributesEnabled(boolean)
logback to summary
public void log(Request request, Response response, long time)

Add the request/response to the access log using the specified processing time.

Parameters
request:Request

Request (associated with the response) to log

response:Response

Response (associated with the request) to log

time:long

Time taken to process the request/response in nanoseconds (use 0 if not known); in Tomcat versions prior to 10, the time unit was milliseconds

setRequestAttributesEnabledback to summary
public void setRequestAttributesEnabled(boolean requestAttributesEnabled)

Should this valve use request attributes for IP address, hostname, protocol and port used for the request? The attributes used are:

  • org.apache.catalina.RemoteAddr
  • org.apache.catalina.RemoteHost
  • org.apache.catalina.Protocol
  • org.apache.catalina.ServerName
  • org.apache.catalina.ServerPost
Parameters
requestAttributesEnabled:boolean

true causes the attributes to be used, false causes the original values to be used.