如何启用jetty-maven-plugin 8服务器调试输出?

时间:2013-03-28 17:05:21

标签: maven slf4j maven-jetty-plugin

我正在尝试将我们的码头从7升级到8,以便我们可以利用servlet 3.0。似乎没有任何设置或配置更改从7到8.之前我们一直使用jetty-maven-plugin 7.2.0.RC0到mvn jetty:run(以及catalina 6.0.29,slf4j 1.5。 9和servlet 2.5)。更新jetty时,我不得不在插件中添加slf4j,log4j和javax.servlet-api依赖项,以免出现API问题。卡塔琳娜依赖一直存在。现在是pom:

  <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.10.v20130312</version>
    <dependencies>
      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-catalina</artifactId>
        <version>7.0.37</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.2</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.2</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.7.2</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>compile</scope>
      </dependency>
    </dependencies>
    <configuration>
      <webAppConfig>
        <contextPath>/widgets</contextPath>
        <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
          <resourcesAsCSV>/Users/dwinsor/neo/neo-js/src/main/webapp,/Users/dwinsor/neo/neo-js/target/neo-js</resourcesAsCSV>
        </baseResource>
        <overrideDescriptor>/Users/dwinsor/neo/neo-js/target/generated-resources/xml/override-web-default.xml</overrideDescriptor>
      </webAppConfig>
      <contextHandlers>
        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
          <war>/Users/dwinsor/neo/neo-js/target/dependency-wars/neo.war</war>
          <contextPath>/</contextPath>
          <tempDirectory>/Users/dwinsor/neo/neo-js/target/tmp-neo</tempDirectory>
        </contextHandler>
      </contextHandlers>
      <scanTargets>
        <scanTarget>src/main/resources</scanTarget>
        <scanTarget>src/main/webapp</scanTarget>
      </scanTargets>
      <jettyConfig>/Users/dwinsor/neo/neo-js/target/generated-resources/xml/jetty.xml</jettyConfig>
      <connectors>
        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
        </connector>
        <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
        </connector>
      </connectors>
    </configuration>
  </plugin>

我的问题是我不再看到我希望看到的那种调试输出。在码头7,当我做mvn码头时:跑步我会看到类似

的东西
  

org.mortbay.jetty.plugin.JettyServer@271bc503已停止   +-SelectChannelConnector@0.0.0.0:8080   +-SslSocketConnector@0.0.0.0:8443   + -qtp62871287 {8&LT = 5℃; = 8 / 254,0}   + -HandlerCollection @ c237b89开始了      + -ContextHandlerCollection @ 6d836598开始了      | + -JettyWebAppContext @ 17043b2f @ 17043b2f /小工具,[文件:/用户/ dwinsor /前雇主   ...   ...   [INFO]启动了Jetty Server

然而,现在,我看到的只是最后一行,[INFO]启动了Jetty Server。 我希望能够看到所有漂亮的WebAppContext输出。我已经尝试过-Dorg.eclipse.jetty.util.log.DEBUG = true和-Dorg.eclipse.jetty.LEVEL = DEBUG,但我们之前并没有使用其中任何一个。如何启用此输出?

谢谢。

1 个答案:

答案 0 :(得分:0)

问题是在jetty 7.3.0上看到的调试输出不再打印出来,除非在jetty.xml中设置了某些属性:

<Set name="dumpAfterStart">true</Set>

<Set name="dumpBeforeStop">true</Set>