Class ApacheLogFormat
java.lang.Object
org.glassfish.grizzly.http.server.accesslog.ApacheLogFormat
- All Implemented Interfaces:
AccessLogFormat
An
AccessLogFormat using a standard vaguely similar and heavily
influenced by Apache's
own custom access log formats.
As with Apache, the format string specified at construction should be composed of these tokens:
%% |
The literal percent sign (can also be escaped with back-slash, like "\%" |
|---|---|
%a |
Remote IP-address |
%A |
Local IP-address |
%b |
Size of response in bytes, excluding HTTP headers, using "-" (a dash character) rather than a "0" (zero) when no bytes are sent |
%B |
Size of response in bytes, excluding HTTP headers |
%{Foobar}C |
The contents of cookie "Foobar" in the request sent to the server |
%D |
The time taken to serve the request, in microseconds |
%h |
Remote host name |
%{local|remote}h |
Host name, either "local" or "remote" |
%H |
The request protocol |
%{Foobar}i |
The contents of the "Foobar: ..." header in the request |
%m |
The request method |
%{Foobar}o |
The contents of the "Foobar: ..." header in the response |
%p |
Local port number |
%{local|remote}p |
The port number, either "local" or "remote" |
%q |
The query string, prepended with a "?" (question mark) if a query string exists, otherwise an empty string |
%r |
First line of request, an alias to "%m %U%q %H" |
%s |
Status code |
%t |
The time the request was received, in standard English format (like "[09/Feb/2014:12:00:34 +0900]") |
%{[format][@timezone]}t |
The time the request was received. Both format and timezone are optional
@" character needs to be used in the format, it must be escaped as "@@" |
%T |
The time taken to serve the request, in seconds |
%{...}T |
The time taken to serve the request. The parameter can be a time unit like:
|
%u |
The remote user name |
%U |
The URL path requested, not including any query string |
%v |
The name of the server which served the request |
- Author:
- Pier Fumagalli, USRZ.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ApacheLogFormatA format compatible with Apache's user-agent format.static final StringAStringrepresenting our version of Apache's user-agent format.static final ApacheLogFormatstatic final ApacheLogFormatA format compatible with Apache's combined format.static final StringAStringrepresenting our version of Apache's combined format.static final ApacheLogFormatstatic final ApacheLogFormatA format compatible with Apache's common format.static final StringAStringrepresenting our version of Apache's common format.static final ApacheLogFormatstatic final ApacheLogFormatA format compatible with Apache's referer format.static final StringAStringrepresenting our version of Apache's referer format.static final ApacheLogFormatstatic final ApacheLogFormatA format compatible with Apache's combined with virtual-hosts format.static final StringAStringrepresenting our version of Apache's combined with virtual-hosts format.static final ApacheLogFormatstatic final ApacheLogFormatA format compatible with Apache's common with virtual-hosts format.static final StringAStringrepresenting our version of Apache's common with virtual-hosts format.static final ApacheLogFormat -
Constructor Summary
ConstructorsConstructorDescriptionApacheLogFormat(String format) Create a newApacheLogFormatinstance by parsing the format from the specifiedString.ApacheLogFormat(TimeZone timeZone, String format) Create a newApacheLogFormatinstance by parsing the format from the specifiedString. -
Method Summary
Modifier and TypeMethodDescriptionReturn the normalized format associated with this instance.
-
Field Details
-
COMMON_FORMAT
AStringrepresenting our version of Apache's common format.- See Also:
-
COMBINED_FORMAT
AStringrepresenting our version of Apache's combined format.- See Also:
-
VHOST_COMMON_FORMAT
AStringrepresenting our version of Apache's common with virtual-hosts format.- See Also:
-
VHOST_COMBINED_FORMAT
AStringrepresenting our version of Apache's combined with virtual-hosts format.- See Also:
-
REFERER_FORMAT
AStringrepresenting our version of Apache's referer format.- See Also:
-
AGENT_FORMAT
AStringrepresenting our version of Apache's user-agent format.- See Also:
-
COMMON
A format compatible with Apache's common format. -
COMBINED
A format compatible with Apache's combined format. -
VHOST_COMMON
A format compatible with Apache's common with virtual-hosts format. -
VHOST_COMBINED
A format compatible with Apache's combined with virtual-hosts format. -
REFERER
A format compatible with Apache's referer format. -
AGENT
A format compatible with Apache's user-agent format. -
COMMON_UTC
-
COMBINED_UTC
-
VHOST_COMMON_UTC
-
VHOST_COMBINED_UTC
-
REFERER_UTC
-
AGENT_UTC
-
-
Constructor Details
-
ApacheLogFormat
Create a newApacheLogFormatinstance by parsing the format from the specifiedString. -
ApacheLogFormat
Create a newApacheLogFormatinstance by parsing the format from the specifiedString.
-
-
Method Details
-
format
Description copied from interface:AccessLogFormatFormat the data contained in the specifiedResponseand return aStringwhich can be appended to an access log file.- Specified by:
formatin interfaceAccessLogFormat- Parameters:
response- TheResponseholding the data to format.timeStamp- TheDateat which the request was originated.responseNanos- The time, in nanoseconds, theResponsetook to complete.
-
getFormat
Return the normalized format associated with this instance.
-