Skip to content

Commit

Permalink
Merge pull request #30 from takari/access-logs
Browse files Browse the repository at this point in the history
allow custom access logs
  • Loading branch information
jvanzyl authored Oct 30, 2019
2 parents f26818f + d33e4dc commit f5d779b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ollie/src/main/java/com/walmartlabs/ollie/OllieServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@
import javax.servlet.SessionCookieConfig;
import javax.servlet.http.HttpServlet;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.ResourceHandler;
Expand Down Expand Up @@ -306,6 +301,11 @@ public Server build(OllieServerBuilder builder) {
statisticsHandler.setHandler(contextHandlerCollection);
server.setHandler(statisticsHandler);

RequestLog requestLog = builder.requestLog();
if (requestLog != null) {
server.setRequestLog(requestLog);
}

return server;
}

Expand Down
12 changes: 12 additions & 0 deletions ollie/src/main/java/com/walmartlabs/ollie/OllieServerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.walmartlabs.ollie.model.StaticResourceDefinition;
import org.apache.shiro.realm.Realm;
import org.eclipse.jetty.security.SecurityHandler;
import org.eclipse.jetty.server.RequestLog;
import org.eclipse.jetty.servlets.CrossOriginFilter;

import javax.servlet.Filter;
Expand Down Expand Up @@ -97,6 +98,8 @@ public class OllieServerBuilder {
Set<OllieShutdownListener> shutdownListeners = Sets.newHashSet();
private String webServletsPath;

private RequestLog requestLog;

public OllieServer build() {
filter("/*").through(CrossOriginFilter.class);
filter("/*").through(GuiceFilter.class);
Expand Down Expand Up @@ -432,4 +435,13 @@ public OllieServerBuilder serveWebServlets(String webServletsPath) {
public String webServletsPath() {
return webServletsPath;
}

public OllieServerBuilder requestLog(RequestLog requestLog) {
this.requestLog = requestLog;
return this;
}

public RequestLog requestLog() {
return requestLog;
}
}

0 comments on commit f5d779b

Please sign in to comment.