I have just started using jetty-maven-plugin.
I found some strange behavior regarding logs and system output.
When I start jetty with maven
mvn -Djetty.port=8093 -Dlog4j.configuration=file:src/log4j.properties jetty:run
I see bean constructor sysout message.
After, when I request the url http://my.local.host:8093/api/rest/admin/houses, browser shows me a correct page, but nothing similar to house! in console or log file.
Hovewer, some other INFO messages from Jetty, Spring etc. get printed there.
@Controller
public class AppAdminClientJsonController {
private final static Logger logger =
LoggerFactory.getLogger(AppAdminClientJsonController.class);
public AppAdminClientJsonController() {
System.out.println("----------AppAdminClientJsonController----------");
}
@RequestMapping(value = "/admin/houses", method = RequestMethod.GET)
public @ResponseBody
List<House> getHouses() {
logger.warn("house!");
System.out.println("house!!");
return Arrays.asList(new House("somesite", "http://somesite.com"));
}
}
So generally Jetty does not respect my logger, and overrides system out stream in some funky manner so nothing gets printed after server is up and running.
What can this be?
Plugin's part in pom.xml
<plugin>
<!-- http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin#Quick_Start:_Get_Up_and_Running -->
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.8.v20121106</version>
<configuration>
<webAppSourceDirectory>${basedir}/${webappRootPath}</webAppSourceDirectory>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/</contextPath>
<descriptor>${basedir}/${webappRootPath}/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
</plugin>
UPDATE
I have just tried printing the System.out object itself. I was right, Jetty overrode it:
At spring init phase it was: java.io.PrintStream@175390b7
After server startup it became: java.io.PrintStream@9c783fc