我目前正在尝试使用 slf4j 为 jetty 8 配置集中式日志记录。我找到了以下 [tutorial][1],但它似乎不适用于 jetty 8。有人知道如何使用 jetty 8 做到这一点吗?
解决方案:
jetty-webapp-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>