Hi Team,

I am trying to enable HTTP-access logs for Orion. Details are at 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429063#c3

If you look at https://wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs 
and some of the other documentation, it suggests I need to add an handler 
to the Jetty server. 

Our WebApplication in org.eclipse.orion.server.configurator makes use of a 
JettyConfigurator to start the server. The JettyConfigurator calls 
startServer() that eventually calls HttpServerManager.updated().

In this updated() method I can comment out the handler line:
        //server.setHandler(httpContext);

and replace it with what is suggested in the Jetty documentation:
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new 
ContextHandlerCollection();
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.setHandlers(new 
Handler[]{contexts,httpContext,requestLogHandler});
        server.setHandler(handlers);
 
        NCSARequestLog requestLog = new 
NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log");
        requestLog.setRetainDays(90);
        requestLog.setAppend(true);
        requestLog.setExtended(true);
        requestLog.setLogTimeZone("EST");
        requestLogHandler.setRequestLog(requestLog);

This gives me exactly what I am looking for, but obviously I am hacking 
the jetty source and need to find the right way to do this, either through 
an extension point or the like.

Unfortunately I cannot seem to find anything. Any ideas on how to properly 
add a handler here?

Cheers...
Anthony
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to