StatViewServlet-用于展示Druid的统计信息
<servlet> <servlet-name>DruidStatView</servlet-name> <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class> </servlet> //提供监控信息展示的html页面以及监控信息的JSON API <servlet-mapping> <servlet-name>DruidStatView</servlet-name> <url-pattern>/druid/*</url-pattern> </servlet-mapping> //根据url-pattern配置访问内置监控页面,当前配置访问的是/druid/index.html
注意:使用StatViewServlet,建议使用druid 0.2.6以上版本
WebStatFilter-网络URL统计
<filter> <filter-name>DruidWebStatFilter</filter-name> <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class> //用于采集web-jdbc关联监控的数据 <init-param> <param-name>exclusions</param-name> <param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,/rs/*</param-value> </init-param> //排除一些不必要的URL <init-param> <param-name>sessionStatMaxCount</param-name> <param-value>1000</param-value> </init-param> //缺省sessionStatMaxCount是1000个 <init-param> <param-name>sessionStatEnable</param-name> <param-value>false</param-value> </init-param> //可以关闭session统计功能 <init-param> <param-name>principalSessionName</param-name> <param-value>xxx.user</param-value> </init-param> //使得druid能够知道当前的session的user是谁 //xxx.user为保存在session中的sessionName //如果保存的是非字符串类型的对象,需要重载toString()方法 <init-param> <param-name>principalCookieName</param-name> <param-value>xxx.user</param-value> </init-param> //使得druid能够知道当前cookie的user是谁 //xxx.user为保存在cookie中的cookieName <init-param> <param-name>profileEnable</param-name> <param-value>true</param-value> </init-param> //druid 0.2.7版本开始支持profile,配置此项能够监控单个URL调用的sql列表 </filter> <filter-mapping> <filter-name>DruidWebStatFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
druid相关配置
最新推荐文章于 2024-07-24 11:33:36 发布