Change javamelody storage directory

I need to track a java application and I am using javamelody.

But the problem is that I have to get the data that javamelody has so that I can show them on another screen. I know that javamelody stores its rdd files in the temp / javamelody directory, now I need to change the storage directory to a different path so that I can get data from this path.

Can this be done?

thanks

+4
source share
3 answers

Oh, I think I found the answer. I just need to install the command line or xml file in my tomcat, like this

<?xml version="1.0" encoding="UTF-8" ?> <Context docBase="pathto\appname.war" path="javamelody" reloadable="false" > <Parameter name='javamelody.storage-directory' value='pathname' override='false'/> </Context> 

Thanks for the help: D

+5
source

In web.xml, define a javamelody filter with the storage-directory parameter, as shown below:

 <filter> <filter-name>javamelody</filter-name> <filter-class>net.bull.javamelody.MonitoringFilter</filter-class> <init-param> <param-name>storage-directory</param-name> <param-value>/path/to/the/storage/directory</param-value> </init-param> </filter> 

I tested using JavaMelody version 1.60.0. See the JavaMelody User Guide for more information.

+1
source

For Spring Download

 public class JavaMelodyConfiguration implements ServletContextInitializer { @Value(value="${javamelody.storage-directory}") String jmStorageDir; @Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.addListener(new SessionListener()); servletContext.setInitParameter("javamelody.storage-directory", jmStorageDir); } 

then you can set the javamelody.storage directory in application.properties

0
source

Source: https://habr.com/ru/post/1485752/


All Articles