[Problem solving] Tomcat: Settings after line breaks in "Java Options" are not reflected

environment

What you want to achieve

I want to output the GC log. Define the setting to output GC log in Java Options of Tomcat. To set Java Options, open tomcat8w.exe and select" Java tab-> Java Options ".

image

problem

Added the option to output GC log to "Java Options" of Tomcat. At this time, I added a line break to distinguish it from the originally set option.

JavaOptions


-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties

-verbose:gc
-Xloggc:/tmp/gclog_%t_%p.txt

image

I pressed the "Apply" button and restarted tomcat (press the stop button and then the start button), but there was no GC log in the / tmp folder. Also, when I closed tomcat8w.exe and reopened it, the GC log settings disappeared from Java Options.

Confirmation of problem

I checked catalina.yyyy-mm-dd.log in C: \ Program Files \ Apache Software Foundation \ Tomcat 8.5 \ logs. The "Command line argument" part was as follows.

txt:catalina.2018-01-01.log


Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp
Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties
Command line argument: exit
Command line argument: abort
Command line argument: -Xms128m
Command line argument: -Xmx256m

Next to -Djava.util.logging.config.file, there were ʻexit and ʻabort, and there was no GC log setting. Apparently, if there is a line break in Java Options, it will end there.

solution

Removed line breaks from Java Options.

javaoptions


-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties
-verbose:gc
-Xloggc:/tmp/gclog_%t_%p.txt

image

catalina-2018-01-01.log


Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp
Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Command line argument: -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties
Command line argument: -verbose:gc
Command line argument: -Xloggc:/tmp/gclog_%t_%p.txt
Command line argument: exit
Command line argument: abort
Command line argument: -Xms128m
Command line argument: -Xmx256m

The GC Log settings were described in catalina-yyyy-mm-dd.log. Then, a GC log named gclog_2018-01-01_15-39-23_pid18096.txt was output to the / tmp folder.

Remarks

Obviously, if you don't press the "Apply" button in the Tomcat settings dialog, the Java Option changes will not take effect. I forgot to press the Apply button and was a little worried, "Why isn't it reflected?"

Summary

Do not include line breaks in Tomcat Java Options.

Recommended Posts

[Problem solving] Tomcat: Settings after line breaks in "Java Options" are not reflected
Line breaks in the entered text are not displayed in view
Remove consecutive line breaks and tabs before and after in Java