Java/Tomcat standalone, how to log/access all the HTTP GET requests
I'm running Tomcat in standalone mode. The "standalone" part is very important: I am not going to install Apache in f开发者_StackOverflow社区ront of Tomcat.
In my question here, about how to implement a "web bug", I got a great answer: Java webapp: how to implement a web bug (1x1 pixel)?
However the answer states:
In your access logs, you can count for your jpg - the output should be"
127.0.0.1 - - [10/Jun/2010:11:38:53 +0530] "GET /mywebapp/jsp/invisible.jpg?1276150133362 HTTP/1.1" 200 991
But, as I feared, I cannot find such logs.
... $ cat apache-tomcat-6.0.26/logs/* | grep GET | wc -l
0
There are a lot of logs. My webapp's custom logs are definitely logged.
So I've got a few related questions:
Does "Tomcat standalone" log every HTTP GET request by default?
If yes, where are every HTTP GET requests logged by default? (how could I have found them myselves?)
If no, can "Tomcat standalone" be configured to log every HTTP GET request?
Note that I know that in my case I can add custom logging alongside with my web bug .jsp and search for that in the logs, but that is not my question here.
My question here is really about how Tomcat standalone (once again, the standalone is very important) deals with logging of all the HTTP GET requests.
It doesn't log requests by default, but will do if you uncomment this valve in conf/server.xml
:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
精彩评论