use of org.eclipse.jetty.server.handler.RequestLogHandler in project druid by druid-io.
the class JettyServerInitUtils method getJettyRequestLogHandler.
public static Handler getJettyRequestLogHandler() {
// Ref: http://www.eclipse.org/jetty/documentation/9.2.6.v20141205/configuring-jetty-request-logs.html
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setRequestLog(new JettyRequestLog());
return requestLogHandler;
}
use of org.eclipse.jetty.server.handler.RequestLogHandler in project killbill by killbill.
the class HttpServer method configure.
public void configure(final HttpServerConfig config, final Iterable<EventListener> eventListeners, final Map<FilterHolder, String> filterHolders) {
server.setStopAtShutdown(true);
// Setup JMX
configureJMX(ManagementFactory.getPlatformMBeanServer());
// HTTP Configuration
final HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSecurePort(config.getServerSslPort());
// Configure main connector
final ServerConnector http = configureMainConnector(httpConfiguration, config.isJettyStatsOn(), config.getServerHost(), config.getServerPort());
// Configure SSL, if enabled
final ServerConnector https;
if (config.isSSLEnabled()) {
https = configureSslConnector(httpConfiguration, config.isJettyStatsOn(), config.getServerSslPort(), config.getSSLkeystoreLocation(), config.getSSLkeystorePassword());
server.setConnectors(new Connector[] { http, https });
} else {
server.setConnectors(new Connector[] { http });
}
// Configure the thread pool
configureThreadPool(config);
// Configure handlers
final HandlerCollection handlers = new HandlerCollection();
final ServletContextHandler servletContextHandler = createServletContextHandler(config.getResourceBase(), eventListeners, filterHolders);
handlers.addHandler(servletContextHandler);
final RequestLogHandler logHandler = createLogHandler(config);
handlers.addHandler(logHandler);
final HandlerList rootHandlers = new HandlerList();
rootHandlers.addHandler(handlers);
server.setHandler(rootHandlers);
}
use of org.eclipse.jetty.server.handler.RequestLogHandler in project killbill by killbill.
the class HttpServer method createLogHandler.
private RequestLogHandler createLogHandler(final HttpServerConfig config) {
final RequestLogHandler logHandler = new RequestLogHandler();
final RequestLog requestLog = new NCSARequestLog(config.getLogPath());
logHandler.setRequestLog(requestLog);
return logHandler;
}
use of org.eclipse.jetty.server.handler.RequestLogHandler in project vespa by vespa-engine.
the class JettyHttpServer method getHandlerCollection.
private HandlerCollection getHandlerCollection(ServerConfig serverConfig, ServletPathsConfig servletPathsConfig, ServletHolder jdiscServlet, ComponentRegistry<ServletHolder> servletHolders, FilterHolder jDiscFilterInvokerFilter, RequestLog requestLog) {
ServletContextHandler servletContextHandler = createServletContextHandler();
servletHolders.allComponentsById().forEach((id, servlet) -> {
String path = getServletPath(servletPathsConfig, id);
servletContextHandler.addServlet(servlet, path);
servletContextHandler.addFilter(jDiscFilterInvokerFilter, path, EnumSet.allOf(DispatcherType.class));
});
servletContextHandler.addServlet(jdiscServlet, "/*");
GzipHandler gzipHandler = newGzipHandler(serverConfig);
gzipHandler.setHandler(servletContextHandler);
StatisticsHandler statisticsHandler = newStatisticsHandler();
statisticsHandler.setHandler(gzipHandler);
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setRequestLog(requestLog);
HandlerCollection handlerCollection = new HandlerCollection();
handlerCollection.setHandlers(new Handler[] { statisticsHandler, requestLogHandler });
return handlerCollection;
}
use of org.eclipse.jetty.server.handler.RequestLogHandler in project helios by spotify.
the class MasterService method setUpRequestLogging.
private void setUpRequestLogging(final Path stateDirectory) {
// Set up request logging
final Handler originalHandler = server.getHandler();
final HandlerCollection handlerCollection;
if (originalHandler instanceof HandlerCollection) {
handlerCollection = (HandlerCollection) originalHandler;
} else {
handlerCollection = new HandlerCollection();
handlerCollection.addHandler(originalHandler);
}
final RequestLogHandler requestLogHandler = new RequestLogHandler();
final RequestLogImpl requestLog = new RequestLogImpl();
requestLog.setQuiet(true);
if (stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toFile().exists()) {
requestLog.setFileName(stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toString());
} else if (this.getClass().getResource(LOGBACK_ACCESS_RESOURCE) != null) {
requestLog.setResource(LOGBACK_ACCESS_RESOURCE);
}
requestLogHandler.setRequestLog(requestLog);
handlerCollection.addHandler(requestLogHandler);
server.setHandler(handlerCollection);
}
Aggregations