[英]how to check what users are accessing my tomcat server running in eclipse (java web development)?
I am developing a java web application and I am using Tomcat installed in Eclipse for my development. 我正在开发一个Java Web应用程序,并且正在使用Eclipse中安装的Tomcat进行开发。 I want to see which computers are accessing my website (running on Tomcat) for testing purposes.
我想查看哪些计算机正在访问我的网站(在Tomcat上运行)以进行测试。
I tried netstat but that is not showing me the required data. 我尝试了netstat,但没有显示所需的数据。
I am developing on a Red Hat desktop. 我正在Red Hat桌面上进行开发。
Thank you in advance. 先感谢您。
You need configure in the file server.xml
in Server/Service/Engine: 您需要在Server / Service / Engine中的
server.xml
文件中进行配置:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
See more in The Valve Component 在阀门组件中查看更多
UPDATE 更新
For to see the log file using the tail
command, you need to know the location of this log file. 要使用
tail
命令查看日志文件,您需要知道此日志文件的位置 。 Using the previously defined names in Valve
example, we can have in a servlet or jsp: 使用
Valve
示例中先前定义的名称,我们可以在servlet或jsp中使用:
<%
String location = System.getProperty("catalina.base") +
java.io.File.separator + "logs" + java.io.File.separator +
"localhost_access_log." + new java.sql.Date(System.currentTimeMillis()) +
".txt";
%>
Example with tail
: 带
tail
示例:
tail -f /home/paul/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/logs/localhost_access_log.2013-05-30.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.