2013-05-11 83 views
1

我目前正尝试使用slf4j为jetty 8配置集中记录。我发现了下面的[教程] [1],但似乎没有与码头工作。8有人知道如何做到这一点与码头8?Jetty 8使用slf4j集中记录

解决方案:

码头,web应用,logging.xml必须具备以下内容:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> 

<!-- =============================================================== --> 
<!-- Enable Centralized Logging in the Jetty Server     --> 
<!-- =============================================================== --> 

<Configure id="Server" class="org.eclipse.jetty.server.Server"> 
    <Ref id="DeploymentManager"> 
    <Call name="addLifeCycleBinding"> 
     <Arg> 
     <New class="org.mortbay.jetty.webapp.logging.CentralizedWebAppLoggingBinding"> 
     </New> 
     </Arg> 
    </Call> 
    </Ref> 
</Configure> 

回答

1

虽然教程,Centralized Logging with Logback,是为码头9创建的,所有的功能,它使用在Jetty 8.1.10上也可以使用。

几点建议:

  1. 使用correct version of the jetty-webapp-logging罐子码头8.1.10。
  2. 处理XML文件时使用correct version of the DOCTYPE
  3. 使用start.jar的命令行是相同的。
  4. start.ini的变化是一样的。

最后,各个记录的例子可以在

找到

https://github.com/jetty-project/jetty-and-logback-example

(提示:建立行家项目然后查看各种${module}/target/jetty-distro/为配置的分配,这些行家构建生产)

+0

通过使用以下jetty-webapp-logging.xml解决它: – aluedeke 2013-05-12 19:04:17