0
votes

I enabled port forwarding from my router to the machine where I have hosted tomcat instance (port 80 to port 8080). But I see the access logs are not getting generated when I access the website from outside my machine (even in the same network).

The logs are getting generated only when I access the website from within the server machine itself (tomcat instance).

I have the default setting for writing logs in tomcat 8.

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />

Update: Though I can access the website using domain name and also using public IP address from anywhere, tomcat only logs the traffic which is generated by accessing the site using IP address and not by domain name.

123.456.123.456/mysite - writes the access log

www.example.com/mysite - doesn't write access log

What can be the cause of this?

1
How are you doing the forwarding? A little detail would be helpful here.mikep
from my router's settings using virtual server port forwarding - site traffic will come on port 80 and then it will be forwarded to port 8080 on a tomcat server ip which is on the same networkdevm
Does access via domain name work at all?user207421
@EJP - yes it does.devm

1 Answers

0
votes

Try to add enableLookups="true" to <Connector> tag in conf/server.xml.

See also: Apache Tomcat 8 Configuration Reference