javaMelody的基本用法

今天项目出了个bug找了好久都没有找到、于是我配置了javaMelody进行项目的监测、
部署步骤如下:


1:首先需要下载两个jar包,分别是javamelody-1.44.0.jar,jrobin-1.5.9.1.jar,第一个jar包下载 地址是:http://code.google.com/p/javamelody/downloads/detail?name=javamelody-1.44.0.jar&amp ;can=2&q=
第二个jar包需要首先下载javamelody-1.44.0.war,然后在解压后的lib下面可以找到该包,该war包的下载地址是:http://code.google.com/p/javamelody/downloads/detail?name=javamelody-1.44.0.war&can=2&q =



2:将刚刚得到的两个jar包放到自己项目的lib目录下。

3:在web.xml配置文件中进行配置,配置内容如下:
         <filter>
<filter-name>monitoring</filter-name>
                <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>

4:重新启动项目,打开连接http://localhost:8080/项目名/monitoring/ 即可看到监控图表




又一种方法:



1、到http://code.google.com/p/javamelody /downloads/list下载zip的压缩包
2、解压缩并将javamelody.war复制到Tomcat发布目录下
3、在被监控项目web.xml中加入如下代码

    <filter>  
            <filter-name>monitoring</filter-name>  
            <filter-class >net.bull.javamelody.MonitoringFilter</filter-class >  
    </filter>  
    <filter-mapping>  
            <filter-name>monitoring</filter-name>  
            <url-pattern>/*</url-pattern>  
    </filter-mapping>  
    <listener>  
            <listener-class >net.bull.javamelody.SessionListener</listener-class >  
    </listener> 

4、将javamelody.jar复制到被监控项目的LIB目录
5、启动Tomcat应用服务器并访问javamelody应用,如http://localhost:8080/javamelody
6、根据实际情况做如下设置

7、点击Add按钮即可


上面是基本的监控、没有加入监控spring容器、

猜你喜欢

转载自songshidong.iteye.com/blog/1849621