How to log Client IP and X-Forwarded-For IP in tomcat access log
问题 How to log Client IP and X-Forwarded-For IP in tomcat access log. I am using %{X-Forwarded-For}i and it logs the actual client address if I access through load balancer. But does not log the actual client address if I directly access the tomcat instance. Is there a way to display the actual client IP address in both the cases? 回答1: From http://www.techstacks.com/howto/configure-access-logging-in-tomcat.html: If you are running a version of tomcat greater than version 6.0.21 or tomcat 7, you