开发者

Tomcat log format disable the IPv6 format

开发者 https://www.devze.com 2023-01-21 18:42 出处:网络
Here are three log exmaples: 127.0.0.1 - - [17/Sep/2010:14:03:07 +0800] \"GET /docs/开发者_JS百科logging.html HTTP/1.1\" 200 24040 \"http://localhost:8000/docs/manager-howto.html\" \"Mozilla/4.0 (co

Here are three log exmaples:

127.0.0.1 - - [17/Sep/2010:14:03:07 +0800] "GET /docs/开发者_JS百科logging.html HTTP/1.1" 200 24040 "http://localhost:8000/docs/manager-howto.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)"
0:0:0:0:0:0:0:1 - - [26/Oct/2010:09:53:30 +0800] "GET /docs/images/tomcat.gif HTTP/1.1" 200 1934 "http://localhost:8000/docs/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
0:0:0:0:0:0:0:1 - - [26/Oct/2010:09:53:30 +0800] "GET /docs/images/asf-logo.gif HTTP/1.1" 200 7279 "http://localhost:8000/docs/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"

The first is correct. However, the IP of the second and the third is the IPv6 format, how to avoid this?


I've observed on my Tomcat 6.0.20 that the IPv6 address is shown when I access it as localhost:8080 whereas the IPv4 (i.e. the dot-decimal notation) is shown when I access it using the IP address or the server name.

Any remote user accessing the URL will also show ipv4 notation.

via IP address or domain name:

172.x.x.x - - [26/Oct/2010:11:19:50 +0530] "GET /examples/servlets/servlet/RequestParamExample HTTP/1.1" 200 665

via localhost:

0:0:0:0:0:0:0:1 - - [26/Oct/2010:11:20:54 +0530] "GET /examples/servlets/servlet/HelloWorldExample HTTP/1.1" 200 359

Does it work the same for you?

0

精彩评论

暂无评论...
验证码 换一张
取 消