Tomcat日志格式禁用IPv6格式 [英] Tomcat log format disable the IPv6 format

查看:327
本文介绍了Tomcat日志格式禁用IPv6格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是三个日志示例:


127.0.0.1 - - [17/Sep/2010:14:03:07 +0800] "GET /docs/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"

第一个是正确的.但是,第二个和第三个的IP是IPv6格式,如何避免这种情况?

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

推荐答案

我在Tomcat 6.0.20上观察到,当我以localhost:8080的形式访问IPv6地址时,显示的是IPv6地址,而IPv4(即点分十进制)当使用IP地址或服务器名称访问它时,会显示该符号.

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.

任何访问URL的远程用户也将显示ipv4表示法.

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

通过IP地址或域名:

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

通过本地主机:

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

它对您有用吗?

这篇关于Tomcat日志格式禁用IPv6格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆