When using embedded
jetty within an application, per default there is no support for
slf4j it is possible to redirect the logging to
log4j2. But without this redirection there is no way to directly use it. But of course there is a way to use it. Only a piece of simple adapter code is required.
Writing an adapter for the
jetty logging api
Jetty uses an own logging api that redirects logging events to a provided logging api. For that api a simple logging adapter is required. This adapter must extend the
org.eclipse.jetty.util.log.AbstractLogger. Before starting
org.eclipse.jetty.util.log.Log.setLog(AbstractLogger) must be invoked in order to replace the default logging mechanism of
In order to get the example simply checkout the source code or go to github.