Hi Alan,
On 09.06.22 12:56, Alan F wrote:
> Tomcat logging
>
> I would like to add a delimiter or characters " " around {user-agent} for
> logging, I wanted it in double quotes for example "Mozilla 5.0.." but can't
> seem to make it work. Or even adding a # symbol before would help any ideas?
I assume, you refer to access logging. Recent Tomcat has a proper example
already in the standard server.xml (IIRC for a long time), just use the "
XML
entity, where you need it (taken from 9.0.64):
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
If you are happy with a standard combined pattern, just use pattern="combined",
it contains user agent in double quotes.
See https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Access_Log_Valve
for complete pattern information.
hth,
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]