我正在尝试调试我的情况,其中简单的ActiveWeb应用程序未在Jetty下运行.它表现得好像没有任何用于请求处理的类并返回错误404.
问题不在于ActiveWeb.这是关于码头.如何找出,有一些Web应用程序,Jetty喜欢注释类并将在HTTP请求上执行它?
目前我已下载Jetty,它的工作原理.不幸的是,它没有记录.当404错误返回时,此时没有显示任何内容stdout或当前stderr没有文件出现在logs子目录中.
如何在jetty中启用日志记录?
这里的文档http://www.eclipse.org/jetty/documentation/current/configuring-logging.html和http://www.eclipse.org/jetty/documentation/current/configuring-jetty-request-logs.html不清楚和争议.
例如,第一页说Jetty不使用任何Java登录框架,但也需要一个选择一个.第二页提供了一些配置示例,但没有说明应放置此代码的位置.
Joa*_*elt 27
文档是正确的,因为术语"Java日志框架"通常与现代日志框架相关联,如java.util.logging,slf4j,logback,log4j,commons-logging,logkit等.
这是正确的,Jetty不使用任何这些.
Jetty日志记录早于标准化日志记录框架中的所有这些工作.(Jetty及其日志层创建于1995年)
这就是码头记录不会(和被记录在文档站点)与关于设置和配置.
默认行为:
要配置:
这可以通过3种不同的方式实现
# 3 different options
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog
Run Code Online (Sandbox Code Playgroud)
jetty-logging.properties从类路径中找到的自发现/配置.# Configure for System.err output
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Configure StdErrLog to log all jetty namespace at default of WARN or above
org.eclipse.jetty.LEVEL=WARN
# Configure StdErrLog to log websocket specific namespace at DEBUG or above
org.eclipse.jetty.websocket.LEVEL=DEBUG
Run Code Online (Sandbox Code Playgroud)
Log.setLog(Logger)这对使用嵌入式码头的人特别有用
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog;
Log.setLog(new StdErrLog());
Run Code Online (Sandbox Code Playgroud)
建议和说明:
Jetty服务器启动的输出将为您提供有关其正在使用的日志记录实现的提示.
正常/默认行为:
2014-09-11 10:48:38.726:INFO::main: Logging initialized @378ms
2014-09-11 10:48:39.067:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/joakim/Code/Jetty/distros/jetty-distribution-9.2.1.v20140609/demo-base/webapps/] at interval 1
Run Code Online (Sandbox Code Playgroud)
请注意,它在输出中没有命名空间声明或严重缩写的命名空间.这告诉我它StdErrLog正在使用中.
如果slf4j正在使用中:
10:50:18.871 [main] INFO org.eclipse.jetty.util.log - Logging initialized @352ms
10:50:19.102 [main] INFO o.e.j.d.p.ScanningAppProvider - Deployment monitor [file:/Users/joakim/Code/Jetty/distros/jetty-distribution-9.2.1.v20140609/demo-base/webapps/] at interval 1
Run Code Online (Sandbox Code Playgroud)
这是- > 的默认控制台appender输出.这里的总体结构与生产的结构非常不同,所以我现在可以告诉码头正在通过实施发射.slf4jlogbackStdErrLogSlf4jLog
| 归档时间: |
|
| 查看次数: |
32164 次 |
| 最近记录: |