From http://eclipse.org/jetty/documentation/current/configuring-jetty-request-logs.html:
NCSARequestLog requestLog = new NCSARequestLog("/var/logs/jetty/jetty-yyyy_mm_dd.request.log");
requestLog.setAppend(true);
requestLog.setExtended(false);
requestLog.setLogTimeZone("GMT");
server.setRequestLog(requestLog);
@wilkinsona Boot is supporting Undertow and Tomcat's their own access log implementation and having an issue for Jetty makes sense but it might be better to close this issue and implement only https://github.com/spring-projects/spring-boot/issues/2609.
Is it possible to send these logs to spring boot slf4j instead of to a file?
@esetnik What do you mean by "these logs"? This issue is still open so nothing described in it is available yet.
@esetnik what I'm doing to redirect to slf4j
@Configuration
public class JettyAccessLogConfiguration {
@Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(
@Value( "${server.port:8080}" ) final String mainPort ) {
final JettyEmbeddedServletContainerFactory factory =
new JettyEmbeddedServletContainerFactory( Integer.valueOf( mainPort ) );
factory.addServerCustomizers( server -> {
server.setRequestLog( new Slf4jRequestLog() );
} );
return factory;
}
}
Jetty request logs
@olamy this is what I was looking for. Thanks!
@esetnik no worries. I missed to say the logger is org.eclipse.jetty.server.RequestLog
Hy there,
for tomcat and undertow we can use server.tomcat.accesslog.enabled: true or server.undertow.accesslog.enabled: true and configure the log pattern, suffix and so on.
Is there any chances that a similar feature could be implemented for jetty ?
Thanks,
Nicolas
@orphaner That's exactly what this issue is tracking
you would be happy if I propose pr? ( I think yes :-) )
@olamy Yes please. We're pretty much always happy when someone proposes a PR.
@wilkinsona Hi is there any place with unit test which test accesslog are really writing to the file?
done with pr #8819
@wilkinsona would you prefer a pr for 1.5.x branch?
@snicoll hi maybe you can review?
@olamy We'll probably target this to 2.0.x since it's an enhancement. I'll close this issue in favor of PR #8819
fair enough.
Well #8819 is simply the pr for this issue :-)
Yeah, we just tend to close the original issue when a PR comes along to reduce the number of open issues.
Most helpful comment
@esetnik what I'm doing to redirect to slf4j
Jetty request logs