配置tomcat日志及虚拟目录

在tomcat的server.xml中添加如下代码:

<Valveclassname="org.apache.catalina.valves.AccessLogValve"

directory="logs"prefix="localhost_access_log."suffix=".txt"

pattern="%h%l%u%t&quot;%r&quot;%s%b&quot;%{Referer}i&quot;&quot;%{User-Agent}i&quot;&quot;%{Cookie}i&quot;&quot;%{Host}i&quot;"resolveHosts="false"/>

directory="logs"是将日志生成到tomcat下面的logs文件夹中

prefix="localhost_access_log."生成日志的命名

配置虚拟目录

<Contextpath="/webstat"

docBase="x:/tomcat5.5/logs"

crossContext="true"

debug="0"

reloadable="true"

trusted="false">

<Valveclassname="org.apache.catalina.valves.RemoteAddrValve"

allow="XXX.XXX.XXX.XXX"/>

</Context>

allow="XXX.XXX.XXX.XXX"可以设置访问的IP

相关推荐