jetty-maven-plugin and logback-access

I'm using the jetty-maven-plugin / "Jetty Maven Plugin" to start up my development server/Jetty container. I would like to integrate logback-access into this setup. I have configured jetty-maven-plugin to load a custom jetty.xml file. In this custom jetty.xml file, I create and configure a ch.qos.logback.access.jetty.RequestLogImpl as pointed out at http://logback.qos.ch/access.html . When I start-up the Jetty container using the jetty-maven-plugin (command "mvn jetty:run [...]"), the Jetty container starts up nicely, but logback-access doesn't get configured correctly: ~~~~Begin: log excerpt~~~~ 22:54:38,250 |-INFO in null - Will use configuration file [logback-access.xml] 22:54:38,251 |-ERROR in null - Could not find configuration file for logback-access ~~~~End: log excerpt~~~~ The problem is: I have no idea what jetty-maven-plugin and logback-access assume as the "relative directory"/"current working directory" used for RequestLogImpl's "fileName" property and "resource" property. For instance *<Set name="fileName">logback-access.xml</Set> doesn't work *<Set name="resource">logback-access.xml</Set> doesn't work *<Set name="resource">src/main/webapp/WEB-INF/logback-access.xml</Set> doesn't work I have placed my logback-access.xml in all kinds of different locations inside my project directory hierarchy, but it never gets found by RequestLogImpl. I hope you have a suggestion where I should put my logback-access.xml and how I should set the "fileName" and "resource" properties. Thank you in advance!

I found the answer myself When using jetty-maven-plugin, the value of RequestLogImpl's "fileName" property is relative to the project's pom.xml . So for instance, when the Maven project layout is like this: ~~~Begin: Maven project layout~~~ |-pom.xml |-[src] | |-.... | |-[logback-access-config] | |-logback-access-localhost.xml | |-... ~~~End: Maven project layout~~~ ... then my correct jetty XML configuration file looks like this: ~~~Begin: jetty XML configuration file~~~ <Configure id="Server" class="org.eclipse.jetty.server.Server"> ... <Set name="handler"> <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.eclipse.jetty.server.Handler"> <Item> <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> </Item> <Item> <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> </Item> <!-- add a RequestLogHandler --> <Item> <New id="RequestLogHandler" class="org.eclipse.jetty.server.handler.RequestLogHandler"/> </Item> </Array> </Set> </New> </Set> <Ref id="RequestLogHandler"> <Set name="requestLog"> <New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl"> <!-- fileName's path is relative to pom.xml --> <Set name="fileName">logback-access-config/logback-access-localhost.xml</Set> </New> </Set> </Ref> ... </Configure> ~~~End: jetty XML configuration file~~~ Cheers
participants (1)
-
Gerrit Hübbers