Closed kyleboyle closed 6 years ago
Hi @kyleboyle,
Unfortunately you're right currently it's not possible to configure the Jetty server from the outside.
You can use Jersey's built in logging filter ServerLoggingFilter
or implement your own with the fields and format you want.
Of course you are more than welcome to submit a pull request.
For those searching for the same thing, I've performed a work-around by brute force access to the server object before start is called:
Server jettyServer = null;
try {
Field f = jerseyServer.getClass().getDeclaredField("server");
f.setAccessible(true);
jettyServer = (Server) f.get(jerseyServer);
} catch (NoSuchFieldException e) {
log.error("Could not identify server field from guice-jersey server object: ", e);
} catch (IllegalAccessException e) {
log.error("Could not access server field from guice-jersey server object: ", e);
}
if (jettyServer != null) {
Slf4jRequestLog requestLog = new Slf4jRequestLog();
requestLog.setExtended(true);
jettyServer.setRequestLog(requestLog);
}
There doesn't seem to be a way to access the jetty server instance so that I can enable jetty request logging. Typically you would just do server.setRequestLog(new Slf4jRequestLog())
It would also be nice to also be able to control the thread pool, etc.