No extra configuration is needed. If log4j.xml or log4j.properties is present in the classpath, it is picked up and logs are directed to the specified appender(s). I found http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin#MavenJettyPlugin-Logging overtly complicated and unnecessary. The logs can be redirected to a file by using a suitable appender in log4j.xml:
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="./target/dmsweb_log_file.log" />
<param name="Append" value="false" >
<param name="MaxBackupIndex" value="1" >
<param name="MaxFileSize" value="500KB" >
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n">
</layout>
</appender>
There are two options:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
...
</scanTargetPatterns>
<systemProperties>
<systemProperty>
<name>jetty.port</name>
<value>8080</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
- command prompt: mvn -Djetty.port=8090 jetty:run
The thing to remember is the command line value will override the value in pom.xml.
I was not able to connect to MsSql using JDBC. I was using the host with the port no. like:
jdbc:jtds:sqlserver//localhost:3683/TestDB
I would always get “Connection refused” exception.
Then I chucked out the port no. from the host name, and it works fine now.
jdbc:jtds:sqlserver://localhost/TestDB