[logback-user] logback-access in an embedded jetty server

Jan-Olav Eide janolaveide at gmail.com
Mon Jan 23 17:23:42 CET 2017


I have small main program that fires up a Jetty 9 server. This server is
able to run/deploy any war file supplied to it as a command line argument.

I construct a *logback-access* appender programmatically, give that
appender to an instance of *ch.qos.logback.access.jetty.RequestLogImpl* and
wrap that instance in a *org.eclipse.jetty.server.handler.RequestLogHandler*
that is finally supplied to the jetty server:

    handlers.addHandler(webappHandler(contextPath(), warURL()));
    handlers.addHandler(requestLogHandler());
    server.setHandler(handlers);

Now, the web-application also uses logback, and has those artifacts in its
*WEB_INF/lib* directory inside the war. It appears that the logback-access
configuration in the main program and the logging performed by the webapp
somewhat interfere with eachother. The symptom is that I see nothing in the
request log, so I guess the logging configuration in the webapp "wins", and
overrides the request log configuration in the main program. If I do not
deploy a webapp, but instead just serve some static files, the request log
works as expected, so I believe that my appender is constructed correctly.

Is there any way the logging configuration from the webapp and the request
log configuration from the server can co-exist ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20170123/c69da4e9/attachment.html>


More information about the logback-user mailing list