使用javamelody监控javaEE
作者:互联网
使用javamelody监控javaEE
github页面
https://github.com/javamelody/javamelody/wiki/UserGuide
接入spring系统中
- 引入 jar 包(maven)
<!-- javamelody-core -->
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.76.0</version>
</dependency>
- 修改 web.xml 文件
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
- 启动项目, 访问 项目根目录/monitoring 即可看到效果
- 添加帐号密码访问
修改上述 web.xml 文件
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
<init-param>
<param-name>authorized-users</param-name>
<param-value>user1:pwd1, user2:pwd2</param-value>
</init-param>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
- 修改页面访问地址
修改上述 web.xml 文件
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
<init-param>
<param-name>authorized-users</param-name>
<param-value>user1:pwd1, user2:pwd2</param-value>
</init-param>
<init-param>
<param-name>monitoring-path</param-name>
<param-value>/admin/performance</param-value>
</init-param>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
- 其他相关设定都可以在 github 上查到相关资料
接入springboot系统中
https://github.com/javamelody/javamelody/wiki/SpringBootStarter
标签:xml,github,javamelody,SessionListener,javaEE,监控,bull,net 来源: https://blog.csdn.net/l707268743/article/details/89182383