0

我正在尝试将我们的码头从 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<=5<=8/254,0} +-HandlerCollection@ c237b89 已启动 +-ContextHandlerCollection@6d836598 已启动 | +-JettyWebAppContext@17043b2f@17043b2f/widgets,[file:/Users/dwinsor/previ ... ... [INFO] Started Jetty Server

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

谢谢你。

4

1 回答 1

0

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

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

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

于 2013-04-17T23:11:18.133 回答