Chen Jian's Java Blog 

Jetty's start.jar forks a new JVM to run the app if logback module is enabled

by Chen Jian


Posted on 2019-07-17 13:48 in Java


Jetty is too smart. If there is any JVM option provided, Jetty will spawn a new JVM instance to do the real work, even if you don't use "--exec" option in start.ini

And jetty's logback module introduces a JVM option. See here

You will see:

-Dorg.eclipse.jetty.util.log.class?=org.eclipse.jetty.util.log.Slf4jLog 

So does it matter?

It matters a lot because all the JVM options you passed to start.jar will stay on the process of start.jar. They are not passed to the forked JVM process.

What's the solution ?

Since you have to let it fork a new JVM because of logback, you can just put all the JVM options in start.ini. Like,


--exec
-server
-Xms2g
-Xmx2g
-XX:+UseZGC




No one has commented yet.
该日志评论功能被禁用了。