Skip to content

Instantly share code, notes, and snippets.

@rmetzler
Created December 9, 2010 12:53
Show Gist options
  • Save rmetzler/734680 to your computer and use it in GitHub Desktop.
Save rmetzler/734680 to your computer and use it in GitHub Desktop.
using log4j with the maven-jetty-plugin
<!-- Run the application using "mvn jetty:run" -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<contextPath>/</contextPath>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8088</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<webApp>${basedir}/target/classes</webApp>
<!-- Log to the console. -->
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
<filename>target/yyyy_mm_dd.request.log</filename>
<retainDays>90</retainDays>
<append>true</append>
<extended>true</extended>
<logTimeZone>GMT</logTimeZone>
</requestLog>
<!-- this is where the log4j.properties file should be found -->
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:./target/classes/log4j.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
@rmetzler
Copy link
Author

rmetzler commented Dec 9, 2010

setting up the log4j.properties file avoids the dreaded log4j ERROS: "No appenders could be found for logger"

You can use systemProperties instead of -Dlog4j.configuration=file:./target/classes/log4j.properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment