javaMelody监控接入使用

1.jar  pom

<!-- javamelody监控接入begin 20150520 gaozhenzhai -->

        <dependency>

            <groupId>net.bull.javamelody</groupId>

            <artifactId>javamelody-core</artifactId>

            <version>1.53.0</version>

        </dependency>

        <!-- javamelody监控接入end 20150520 gaozhenzhai -->

 

2.web.xml

<listener>

        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>classpath:net/bull/javamelody/monitoring-spring.xml;classpath:spring-config.xml;classpath:spring-config-struts.xml</param-value>

    </context-param>

 

<filter>

        <filter-name>monitoring</filter-name>

        <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>

        <init-param>

            <param-name>url-exclude-pattern</param-name>

            <param-value>/static/.*</param-value>

        </init-param>

        <init-param>

            <param-name>authorized-users</param-name>

            <param-value>venderlegal:1gzz@LEGALMAN</param-value>

        </init-param>

    </filter>

    <filter-mapping>

        <filter-name>monitoring</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

 

struts.xml

<interceptors>

            <interceptor name="monitoring" class="net.bull.javamelody.StrutsInterceptor"/>

 

 

<package name="illegalBase" extends="struts-default">

        <result-types>

            <result-type name="velocity" class="com.jd.common.struts.velocity.VelocityLayoutResult" default="true" />

        </result-types>

        <interceptors>

            <interceptor name="monitoring" class="net.bull.javamelody.StrutsInterceptor"/>

            <interceptor name="loginContext" class="com.jd.pop.admin.web.interceptor.AdminLoginContextInterceptor"/>

            <interceptor-stack name="strutsDefaultStack">

                <interceptor-ref name="monitoring"/>

                <interceptor-ref name="exception" />

                <interceptor-ref name="alias" />

                <interceptor-ref name="servletConfig" />

                <interceptor-ref name="i18n" />

                <interceptor-ref name="prepare" />

                <interceptor-ref name="chain" />

                <interceptor-ref name="debugging" />

                <interceptor-ref name="scopedModelDriven" />

                <interceptor-ref name="modelDriven" />

                <interceptor-ref name="fileUpload">

                    <param name="maximumSize">4194304</param><!--单个文件最大4M-->

                    <param name="allowedTypes">image/x-png,image/png,image/gif,image/jpeg,image/jpg,image/pjpeg,application/x-shockwave-flash,application/octet-stream,application/vnd.ms-excel,application/msword,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/zip</param>

                    <param name="allowedExtensions">jpg,jpeg,png,gif,txt,swf,xls,xlsx,doc,docx,zip,pdf</param>

                </interceptor-ref>

                <interceptor-ref name="checkbox" />

                <interceptor-ref name="multiselect" />

                <interceptor-ref name="staticParams" />

                <interceptor-ref name="actionMappingParams" />

                <interceptor-ref name="params">

                    <param name="excludeParams">dojo\..*,^struts\..*,.*\\u0023.*</param>

                </interceptor-ref>

                <interceptor-ref name="conversionError" />

                <interceptor-ref name="validation">

                    <param name="excludeMethods">input,back,cancel,browse</param>

                </interceptor-ref>

                <interceptor-ref name="workflow">

                    <param name="excludeMethods">input,back,cancel,browse</param>

                </interceptor-ref>

            </interceptor-stack>

            <interceptor-stack name="illegalInterceptor">

                <interceptor-ref name="strutsDefaultStack" />

                <interceptor-ref name="loginContext" />

            </interceptor-stack>

        </interceptors>

        <default-interceptor-ref name="illegalInterceptor" />

        <global-results>

            <result name="exception">/WEB-INF/vm/error.vm</result>

            <result name="input">/WEB-INF/vm/paramError.vm</result>

            <result name="error">/WEB-INF/vm/error.vm</result>

            <result name="illegal">/WEB-INF/vm/illegal.vm</result>

            <result name="login_error">/WEB-INF/vm/loginerror.vm</result>

            <result name="login" type="redirect">${loginUrl}</result>

        </global-results>

        <global-exception-mappings>

            <exception-mapping exception="java.lang.Exception" result="exception" />

        </global-exception-mappings>

    </package>

 

 

你可能感兴趣的:(javaMelody监控接入使用)