start tomcat with specific java parameters
The "official" way to set extra parameters to Tomcat is via creating bin/catalina.sh
in Unix or bin\catalina.bat
in Windows. In your (Windows) case, the file should look like as follows:
set CATALINA_OPTS=%CATALINA_OPTS% -Djavax.net.debug=all
Cratylus
Updated on March 12, 2020Comments
-
Cratylus about 4 years
I am starting Tomcat using the startup.bat in the TOMCAT_HOME\bin directory.
I need to enable all the java's debugging traces.
In my web app (Note: Actually it is an axis2 web service) I did:
System.setProperty("javax.net.debug","all");
But it did not work.
Nothing printed to Tomcat console.
I tried to put this property as parameter in Tomcat on start-up so I edited the catalina.bat as follows:
Before:if not "%LOGGING_MANAGER%" == "" goto noJuliManager set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager :noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%
After:
if not "%LOGGING_MANAGER%" == "" goto noJuliManager set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager :noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% set JAVA_OPTS=-Djavax.net.debug=all %JAVA_OPTS%
I am not sure if this is the write place to put it in catalina.bat, but it seemed reasonable to me.
No success as well.
So how can I start tomcat with a -Djava option?
Specifically how can I enableSystem.setProperty("javax.net.debug","all");
so that I can do the debugging in my web app?Thank you.
-
Cratylus about 13 yearsTried it but no success.But may be I am wrong here.I see in the java code the following:
if (debug != null) {debug.println("---checking " + msg + "..."); etc
is this not supposed to go to console? Also no extra debugging traces are shown in the Tomcat console even with this option -
mindas about 13 yearsTry launch Tomcat by calling "catalina.bat run" so the output goes to your stdout (and watch it), maybe your logging configuration is misconfigured?