I am trying to debug my case, where simple ActiveWeb application is not running under Jetty. It behaves as if no any classes for request processing exist and return error 404.>
Starting with Jetty 10.0.0, there is no longer a "Jetty Logging" facade.
The Jetty project has moved to using SLF4J 2.0 only.
The documentation is correct, as the term "Java Logging Framework" is often associated with modern logging frameworks like java.util.logging, slf4j, logback, log4j, commons-logging, logkit, etc.
This is correct, Jetty does not use any of those.
Jetty logging predates ALL of those efforts at standardized logging frameworks. (Jetty, and its logging layer was created in 1995)
This is what Jetty logging does (and is documented at the documentation site) with regards to setup and configuration.
Default behavior:
To configure:
This can be accomplished in 3 different ways
# 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
jetty-logging.properties
self discover/configuration found from classpath.Example from jetty project itself:
# 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
This is particularly useful for those using embedded-jetty
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog;
Log.setLog(new StdErrLog());
Advice and Notes:
The output of your Jetty server startup will give you hints about the logging implementation it is using.
Normal / Default behavior:
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
Notice that this has either no namespace declaration, or heavily abbreviated namespace in its output. This tells me that the StdErrLog
is in use.
If slf4j is in use:
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
This is a default Console appender output for slf4j
-> logback
. The overall structure here is very different that what the StdErrLog
produces, so I can now tell that jetty is emitting via the Slf4jLog
implementation.