Search code examples
javaapachetomcattomcat6tomcat8

how to create localhost_access_log file in tomcat 6


In my localhost I am using tomcat 8 which is having localhost_access_log file.In this file all the requests along with IPAddress,dateTime,Request type(get/post) along with full URL are captured. But main server is not using tomcat 8 and they are using tomcat 6.So here there is no localhost_access_log file and hence I could not know what and when requests are made to server.

So is there any way to create localhost_access_log or any other way to know the requests made to server?


Solution

  • You have to change yout configuration to:

    <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
    
            <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
    
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html -->
    
            <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
                   prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
    </Host>
    

    See here for more information.