You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Tang <er...@muneris.io> on 2015/09/08 12:31:02 UTC

Tomcat access log customization

Dear Tomcat support,

I am a developer working on Java applications and have been using different
containers and deployment platforms. I would like to have a question on the
access logs.

The access logs of Tomcat is configured in $TOMCAT_HOME/conf/server.xml,
the "Valve" attribute
with className="org.apache.catalina.valves.AccessLogValve". The format of
log is governed by the pattern expression, referenced in the documentation
of Tomcat (TOMCAT_URI/config/valve.html).

Is it possible to format the log with customized field name and string
contents? I've been looking for answer in the web but no clear answer is
found.
I read through the usage / developer docs and source codes of Tomcat and
find some clues. Would such require modifications of Tomcat source codes:

Editing "protected AccessLogElement createAccessLogElement()" to add new
pattern items in the switch-case flow for any new field-value pairs, and
implement new element class(es) for AccessLogValue.

Could you please kindly help to advise?
Thank you.

Eric

Re: Tomcat access log customization

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 08.09.2015 um 12:31 schrieb Eric Tang:
> Dear Tomcat support,
>
> I am a developer working on Java applications and have been using different
> containers and deployment platforms. I would like to have a question on the
> access logs.
>
> The access logs of Tomcat is configured in $TOMCAT_HOME/conf/server.xml,
> the "Valve" attribute
> with className="org.apache.catalina.valves.AccessLogValve". The format of
> log is governed by the pattern expression, referenced in the documentation
> of Tomcat (TOMCAT_URI/config/valve.html).
>
> Is it possible to format the log with customized field name and string
> contents? I've been looking for answer in the web but no clear answer is
> found.
Could you provide samples of such customized fields you want to add?

Regards,
  Felix
> I read through the usage / developer docs and source codes of Tomcat and
> find some clues. Would such require modifications of Tomcat source codes:
>
> Editing "protected AccessLogElement createAccessLogElement()" to add new
> pattern items in the switch-case flow for any new field-value pairs, and
> implement new element class(es) for AccessLogValue.
>
> Could you please kindly help to advise?
> Thank you.
>
> Eric
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org