【问题标题】:How do I enable jetty-maven-plugin 8 server debug output?如何启用 jetty-maven-plugin 8 服务器调试输出?
【发布时间】:2013-03-19 05:58:28
【问题描述】:

我正在尝试将我们的码头从 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 问题。 catalina 依赖一直存在。现在是 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 jetty:run 时,我会看到类似

org.mortbay.jetty.plugin.JettyServer@271bc503 已停止 +-SelectChannelConnector@0.0.0.0:8080 +-SslSocketConnector@0.0.0.0:8443 +-qtp62871287{8

然而,现在我看到的只是最后一行,[INFO] Started Jetty Server。 我希望能够看到所有漂亮的 WebAppContext 输出。我已经尝试过 -Dorg.eclipse.jetty.util.log.DEBUG=true 和 -Dorg.eclipse.jetty.LEVEL=DEBUG,但无论如何我们之前都没有使用过这两种方法。如何启用此输出?

谢谢。

【问题讨论】:

    标签: maven slf4j maven-jetty-plugin


    【解决方案1】:

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

    &lt;Set name="dumpAfterStart"&gt;true&lt;/Set&gt;

    &lt;Set name="dumpBeforeStop"&gt;true&lt;/Set&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-06
      • 2014-04-23
      • 1970-01-01
      • 2011-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多