启动码头时如何关闭不必要的日志?

how to turn off unnecessary log when start jetty?

我正在尝试嵌入码头 9.4.21.v20190926。但是它显示了很多像这样的不必要的日志:

  Server@239963d8{STARTED}[9.4.21.v20190926] - STARTED
    += QueuedThreadPool[qtp1268447657]@4b9af9a9{STARTED,8<=8<=200,i=5,r=4,q=0}[ReservedThreadExecutor@46daef40{s=0/4,p=0}] - STARTED
    |  += ReservedThreadExecutor@46daef40{s=0/4,p=0} - STARTED
    |  +> threads size=8
    |     +> 17 qtp1268447657-17 IDLE TIMED_WAITING @ sun.misc.Unsafe.park(Native Method)
    |     +> 12 qtp1268447657-12-acceptor-0@f5bee51-ServerConnector@7de26db8{HTTP/1.1,[http/1.1]}{0.0.0.0:23689} ACCEPTING RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) prio=3
sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
    += ServerConnector@7de26db8{HTTP/1.1,[http/1.1]}{0.0.0.0:23689} - STARTED
    |  +~ Server@239963d8{STARTED}[9.4.21.v20190926] - STARTED
    |  +~ QueuedThreadPool[qtp1268447657]@4b9af9a9{STARTED,8<=8<=200,i=5,r=4,q=0}[ReservedThreadExecutor@46daef40{s=0/4,p=0}] - STARTED
    |  += ScheduledExecutorScheduler@12f41634{STARTED} - STARTED
    |  +- org.eclipse.jetty.io.ArrayByteBufferPool@13c27452
    |  += HttpConnectionFactory@7637f22[HTTP/1.1] - STARTED
    |  |  +- HttpConfiguration@262b2c86{32768/8192,8192/8192,https://:0,[]}
    |  |     +> customizers size=0
    |  |     +> formEncodedMethods size=2
    |  |     |  +> POST
    |  |     |  +> PUT
    |  |     +> outputBufferSize=32768
    |  |     +> MANY THINGs......
    |  |     +> MANY THINGs......
    += ErrorHandler@2de8284b{STARTED} - STARTED
    += DefaultSessionIdManager@17d0685f{STARTED}[worker=node0] - STARTED
    |  += HouseKeeper@67b92f0a{STARTED}[interval=660000, ownscheduler=true] - STARTED
    +> sun.misc.Launcher$AppClassLoader@12a3a380
       +> URLs size=18
       |  +> file:~lib/jetty-io-9.4.21.v20190926.jar
       |  +> MANY THINGs......
       |  +> file:~lib/javax.servlet-api-3.1.0.jar
       |  +> MANY THINGs......
       |  +> MANY THINGs......
       |  +> file:~build/classes/
       +> sun.misc.Launcher$ExtClassLoader@396e2f39
          +> URLs size=12
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/access-bridge-64.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/cldrdata.jar


             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/jfxrt.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/localedata.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/nashorn.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/sunec.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/sunjce_provider.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/sunmscapi.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/sunpkcs11.jar
             +> file:/C:/Program%20Files/Java/jdk1.8.0_211/jre/lib/ext/zipfs.jar

这眼睛好痛。反正有没有像下面这样减少日志?

2020-01-12 09:30:36.323:INFO::main: Logging initialized @285ms to org.eclipse.jetty.util.log.StdErrLog
 2020-01-12 09:30:37.139:INFO:oejs.Server:main: jetty-9.4.21.v20190926; built: 2019-09-26T16:41:09.154Z; git: 72970db61a2904371e1218a95a3bef5d79788c33; jvm 1.8.0_211-b12
    2020-01-12 09:30:37.307:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
    2020-01-12 09:30:37.307:INFO:oejs.session:main: No SessionScavenger set, using defaults
    2020-01-12 09:30:37.311:INFO:oejs.session:main: node0 Scavenging every 660000ms
    2020-01-12 09:30:37.390:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@42f93a98{/,null,AVAILABLE}
    2020-01-12 09:30:37.762:INFO:oejs.AbstractConnector:main: Started ServerConnector@7de26db8{HTTP/1.1,[http/1.1]}{0.0.0.0:23689}
    2020-01-12 09:30:37.762:INFO:oejs.Server:main: Started @1736ms

我只先添加 jetty.jar 然后在 运行 时通过错误日志添加所有必要的 jar。 如您所见,它是太多无用的日志,甚至让我写更多关于 post 我的问题。

这是一个jetty server dump。默认情况下,启动后不显示,但可以通过服务器配置。在嵌入式代码中,您可以使用 server.setDumpAfterStart(true/false) 到 enable/disable this.