简体   繁体   English

如何检查哪些用户正在访问我在Eclipse中运行的tomcat服务器(Java Web开发)?

[英]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 &quot;%r&quot; %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.

相关问题 使用Tomcat服务器在Eclipse中运行Java Web应用程序时系统重新启动 - system restarts while running a java web application in eclipse with tomcat server 如果出现错误,如何检查Tomcat Web应用程序是否正在运行并重定向到另一台服务器? - How to check if Tomcat Web Application is running and redirect to another server if there is an error? 在 eclipse 中运行的 tomcat 和在服务器上运行的 tomcat 有什么区别? - What is the difference between tomcat running inside eclipse and tomcat running on a server? 在Eclipse项目中的Eclipse上运行Java EE Web服务器“ Servlet”的Eclipse中,尝试部署无关的目录 - In Eclipse running a Java EE Web Server “Servlet” on Tomcat project attempts to deploy extraneous directories Eclipse + Tomcat如何让服务器保持运行 - Eclipse + Tomcat how to keep the server running Apache Tomcat和Apache TomEE服务器未在Eclipse中运行Web项目 - Apache Tomcat and Apache TomEE server is not running web projects in eclipse 如何获取访问托管在 apache tomcat 服务器上的 java web 应用程序的计算机和用户信息? - How to get computer and user info accessing a java web application hosted on apache tomcat server? 使用Java在eclipse中创建的Jersey Tomcat Web服务器的404错误 - 404 Error for a Jersey Tomcat web server created in eclipse with java 在Eclipse中运行Tomcat服务器时出错 - Error on running tomcat server in Eclipse 没有Eclipse的Java Web开发 - Java web development without Eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM