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

Ceki Gülcü ceki at qos.ch
Mon Jan 23 18:15:16 CET 2017


Hi Jan-Olav,

Thank you for your message.

In principle, logback-access and logback-classic are initialized 
independently.  However, both are based on logback-core and require it 
to be available and the class path. Thus, if you wish to use 
logback-access and logback-classic than you need to make sure that 
logback-core.jar is accessible to  your web-app as well as jetty. 
Without knowing how jetty sets up its classpath, it is hard to be more 
specific.

However, I am 100% certain that your hypothesis about one configuration 
winning over the other is incorrect.  As mentioned above, logback-access 
and logback-classic are initialized independently. In no way do they 
reference each-other's configuration files.

I hope this helps.


--
Ceki

Ps.  please let us know if you figure this out.


On 1/23/2017 17:23, Jan-Olav Eide wrote:
> 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 ?
>
>
>
> _______________________________________________
> logback-user mailing list
> logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>


More information about the logback-user mailing list