Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Standalone Tomcat log files for Analog and Report Magic

Status
Not open for further replies.

PascualMunoz

Instructor
Dec 17, 2004
2
NL
Hi all,

I am running Tomcat standalone (not connected to Apache) on a Linux box. I'd like to get Tomcat log files in a format such a way I can process them with Analog (and later on ReportMagic), the same I do with the Apache access_log files.

Any idea on how to make that? Is it possible to instruct Tomcat to write log files in the Apache format? That would solve the thing straightforward ...

Thanks in advance,

Pascual.
 
You need to alter the <Valve> element in the <Host> section of tomcat's server.xml. EG :

Code:
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="myhost_access_log." suffix=".txt"
                 pattern="%h %t  HTTP_REQUEST(%r %s)  REFERER(%{Referer}i)" resolveHosts="false"/>

To make the logs look like Apache logs, you need to obviously alter the above pattern attribute to produce the correct format.

All the possible directives/patterns are here :

[ignore][/ignore]



--------------------------------------------------
Free Database Connection Pooling Software
 
Hi sedj,

Thank you very much. I forgot to say I am still using Tomcat 3.3.1 ... is it possible to use Valve with this version? I can't find the <Host> section in the server.xml file.

Thanks again.
 
3.3 ? Wow, thats a seriously old version ! I would certainly upgrade to version 5 if I were you ...

Anyhow, as I remember, in server.xml, there is a tag named <AccessLogInterceptor> which you should uncomment, and add your format in there - I think this does the same thing as the logging valve in tomcat 4/5.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top