Jan Luehe's Blog
Access Log Patterns and Nicknames
Access Log Patterns and Nicknames
- common, for the "common" access log pattern from Apache
- combined, for the "combined" access log pattern from Apache
GlassFish v2 makes it easier to specify well-known access log patterns, by allowing you to specify access log patterns by their well-established nicknames.
In GlassFish, you normally use the format attribute of the <access-log> subelement of <http-service> to specify the
access log pattern of your virtual servers.
The default access log pattern looks like this:
format="%client.name% %auth-user-name% %datetime% %request% %status% %response.length%"
The above are just a subset of the access log pattern tokens supported by GlassFish. The complete list of access log pattern tokens, from which you can assemble your own custom access log pattern, is as follows:
%auth-user-name%
%client.dns%
%client.name%
%cookie.value%
%datetime%
%header.accept%
%header.%
%header.auth%
%header.date%
%header.if-mod-since%
%header.user-agent%
%header.referer%
%http-method%
%http-uri%
%http-version%
%query-str%
%referer%
%request%
%response.length%
%status%
%user.agent%
%vs.id%
Due to popular demand, GlassFish v2 supports shortcuts for well known access log patterns, allowing you to specify an access log pattern by its nickname, instead of having to list its constituent tokens.
Currently, the following access log pattern nicknames are supported:
Additional nicknames will be added in the future, based on the GlassFish community's input.
So, in order to change the access log pattern from the GlassFish default to Apache's "common" format, all you need to do is issue the following asadmin command (or use the admin gui):
asadmin set server.http-service.access-log.format="common"
or to change it to Apache's "combined" format, issue this command:
asadmin set server.http-service.access-log.format="combined"
Provided that access logging has been enabled, the above commands will take effect immediately, without requiring a server restart.
Posted at 10:09AM Mar 09, 2007 by Jan Luehe in Sun | Comments[6]