I am using javamelody to monitor my application in a tomcat8. The context.xml is defined like:
<Context path="/foo" docBase="foo.war" reloadable="false">
<Parameter name='javamelody.storage-directory' value='/srv/data/foo/javamelody' override='false'/>
<Parameter name='javamelody.log' value='true' override='false'/>
</Context>
And accordingly to the docs of javamelody:
The parameter storage-directory is the name of the directory of storage (javamelody by default). If the name of the directory starts with '/' (or on Windows, with drive specifier followed by '', or if its prefix is "\"), it is considered as an absolute path, otherwise it is considered as relative to the temporary directory ( in TOMCAT_HOME for tomcat).
But it does not work. I always lands in:
<WINDOWS-PATH>\apache-tomcat-8.5.34\temp\srv\data\foo\javamelody\foo_HOSTNAME
I also tried values like:
\/srv/data/foo/javamelody
\srv\data\foo\javamelody
But It's always in the /temp folder of tomcat
Javamelody version: 1.82.0
There was an escape issue in this part of the docs. It now says:
The parameter storage-directory is the name of the directory of storage (javamelody by default). If the name of the directory starts with '/' (or on Windows, with drive specifier followed by '\', or if its prefix is "\\"), it is considered as an absolute path, otherwise it is considered as relative to the temporary directory
So you can write in your context:
<Context path="/foo" docBase="foo.war" reloadable="false">
<Parameter name='javamelody.storage-directory' value='c:\srv\data\foo\javamelody' override='false'/>
<Parameter name='javamelody.log' value='true' override='false'/>
</Context>