La extensión de la respuesta de Gili un poco; El uso de propiedades-maven-plugin es una manera conveniente de establecer las propiedades del sistema en lugar de tener que especificarlas en la línea de comando. Proporciono ejemplos para logback y log4j. Agregue este bloque de complemento a su pom.xml además de la configuración de jetty-maven-plugin en la respuesta de Gili.
Logback:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<!-- makes jetty log the exception if it fails to initialize slf4j -->
<property>
<name>org.eclipse.jetty.util.log.IGNORED</name>
<value>true</value>
</property>
<!-- Location of logback config -->
<property>
<name>logback.configurationFile</name>
<value>/path/to/logback.xml</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
Log4j:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<!-- makes jetty log the exception if it fails to initialize slf4j -->
<property>
<name>org.eclipse.jetty.util.log.IGNORED</name>
<value>true</value>
</property>
<!-- this tells where the log4j configuration is -->
<property>
<name>log4j.configuration</name>
<value>file:./src/main/resources/log4j.properties</value>
</property>
<!-- this can be uncommented to debug startup log4j itself,
e.g. how it locates log4j.properties etc -->
<!--
<property>
<name>log4j.debug</name>
<value></value>
</property>
-->
</properties>
</configuration>
</execution>
</executions>
</plugin>
También para log4j, naturalmente, utilizar la siguiente dependencia para el amarre-experto-plugin en lugar de logback-clásico:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
...
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
</plugin>
Nota, para configurar el registro solo hazle saber a maven dónde está tu archivo de configuración: mvn verify -Dlogback.configurationFile =/path/to/logback.xml – Mike
¿Hay alguna actualización para la versión 9? No veo ningún registro de Jetty cuando uso esta configuración. – user64141
@ user64141 No tengo conocimiento de ningún cambio. Dicho esto, ya no uso el plugin Jetty maven. Ahora invoco a Jetty desde una clase Java normal. – Gili