Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
bbc7037171
|
@ -33,12 +33,13 @@ import org.eclipse.jetty.plus.webapp.EnvConfiguration;
|
|||
import org.eclipse.jetty.plus.webapp.PlusConfiguration;
|
||||
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.AsyncRequestLogWriter;
|
||||
import org.eclipse.jetty.server.CustomRequestLog;
|
||||
import org.eclipse.jetty.server.DebugListener;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.LowResourceMonitor;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnectionStatistics;
|
||||
|
@ -200,14 +201,11 @@ public class LikeJettyXml
|
|||
server.setHandler(rewrite);
|
||||
|
||||
// === jetty-requestlog.xml ===
|
||||
NCSARequestLog requestLog = new NCSARequestLog();
|
||||
requestLog.setFilename(jetty_home + "/logs/yyyy_mm_dd.request.log");
|
||||
requestLog.setFilenameDateFormat("yyyy_MM_dd");
|
||||
requestLog.setRetainDays(90);
|
||||
requestLog.setAppend(true);
|
||||
requestLog.setExtended(true);
|
||||
requestLog.setLogCookies(false);
|
||||
requestLog.setLogTimeZone("GMT");
|
||||
AsyncRequestLogWriter logWriter = new AsyncRequestLogWriter(jetty_home + "/logs/yyyy_mm_dd.request.log");
|
||||
CustomRequestLog requestLog = new CustomRequestLog(logWriter, CustomRequestLog.EXTENDED_NCSA_FORMAT + " \"%C\"");
|
||||
logWriter.setFilenameDateFormat("yyyy_MM_dd");
|
||||
logWriter.setRetainDays(90);
|
||||
logWriter.setTimeZone("GMT");
|
||||
server.setRequestLog(requestLog);
|
||||
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.CustomRequestLog;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
|
@ -117,8 +117,7 @@ public class ManyHandlers
|
|||
|
||||
// configure request logging
|
||||
File requestLogFile = File.createTempFile("demo", "log");
|
||||
NCSARequestLog ncsaLog = new NCSARequestLog(
|
||||
requestLogFile.getAbsolutePath());
|
||||
CustomRequestLog ncsaLog = new CustomRequestLog(requestLogFile.getAbsolutePath());
|
||||
server.setRequestLog(ncsaLog);
|
||||
|
||||
// create the handler collections
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.AsyncRequestLogWriter">
|
||||
<Arg><Property name="jetty.base" default="." />/<Property>
|
||||
<Name>jetty.customrequestlog.filePath</Name>
|
||||
<Name>jetty.requestlog.filePath</Name>
|
||||
<Default><Property name="jetty.requestlog.dir" default="logs"/>/yyyy_mm_dd.request.log</Default>
|
||||
</Property></Arg>
|
||||
<Arg/>
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
<!-- Format String -->
|
||||
<Arg>
|
||||
<Property name="jetty.requestlog.formatString">
|
||||
<Property name="jetty.customrequestlog.formatString">
|
||||
<Default>
|
||||
<Get class="org.eclipse.jetty.server.CustomRequestLog" name="EXTENDED_NCSA_FORMAT"/>
|
||||
</Default>
|
||||
|
|
|
@ -34,8 +34,8 @@ logs/
|
|||
## Whether to append to existing file
|
||||
# jetty.requestlog.append=false
|
||||
|
||||
## Timezone of the log entries
|
||||
## Timezone of the log file rollover
|
||||
# jetty.requestlog.timezone=GMT
|
||||
|
||||
## Format string
|
||||
# jetty.requestlog.formatString=%a - %u %t "%r" %s %B "%{Referer}i" "%{User-Agent}i" "%C"
|
||||
# jetty.customrequestlog.formatString=%a - %u %{dd/MMM/yyyy:HH:mm:ss ZZZ|GMT}t "%r" %s %B "%{Referer}i" "%{User-Agent}i" "%C"
|
||||
|
|
|
@ -42,6 +42,11 @@ public class AsyncRequestLogWriter extends RequestLogWriter
|
|||
this(null, null);
|
||||
}
|
||||
|
||||
public AsyncRequestLogWriter(String filename)
|
||||
{
|
||||
this(filename, null);
|
||||
}
|
||||
|
||||
public AsyncRequestLogWriter(String filename, BlockingQueue<String> queue)
|
||||
{
|
||||
super(filename);
|
||||
|
|
|
@ -305,6 +305,22 @@ public class CustomRequestLog extends ContainerLifeCycle implements RequestLog
|
|||
}
|
||||
}
|
||||
|
||||
public CustomRequestLog(String file)
|
||||
{
|
||||
this(file, NCSA_FORMAT);
|
||||
}
|
||||
|
||||
public CustomRequestLog(String file, String format)
|
||||
{
|
||||
this(new RequestLogWriter(file), format);
|
||||
}
|
||||
|
||||
@ManagedAttribute("The RequestLogWriter")
|
||||
public RequestLog.Writer getWriter()
|
||||
{
|
||||
return _requestLogWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the request and response information to the output stream.
|
||||
*
|
||||
|
|
|
@ -18,13 +18,24 @@
|
|||
|
||||
package org.eclipse.jetty;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.CustomRequestLog;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
@ -47,16 +58,6 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
import org.eclipse.jetty.webapp.WebInfConfiguration;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Disabled("Not a test case")
|
||||
public class TestServer
|
||||
{
|
||||
|
@ -123,8 +124,7 @@ public class TestServer
|
|||
server.addBean(login);
|
||||
|
||||
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");
|
||||
NCSARequestLog requestLog = new NCSARequestLog(log.toString());
|
||||
requestLog.setExtended(false);
|
||||
CustomRequestLog requestLog = new CustomRequestLog(log.toString());
|
||||
server.setRequestLog(requestLog);
|
||||
|
||||
server.setStopAtShutdown(true);
|
||||
|
|
Loading…
Reference in New Issue