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.plus.webapp.PlusConfiguration;
|
||||||
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
|
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
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.DebugListener;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.HttpConfiguration;
|
import org.eclipse.jetty.server.HttpConfiguration;
|
||||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||||
import org.eclipse.jetty.server.LowResourceMonitor;
|
import org.eclipse.jetty.server.LowResourceMonitor;
|
||||||
import org.eclipse.jetty.server.NCSARequestLog;
|
|
||||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.ServerConnectionStatistics;
|
import org.eclipse.jetty.server.ServerConnectionStatistics;
|
||||||
|
@ -200,14 +201,11 @@ public class LikeJettyXml
|
||||||
server.setHandler(rewrite);
|
server.setHandler(rewrite);
|
||||||
|
|
||||||
// === jetty-requestlog.xml ===
|
// === jetty-requestlog.xml ===
|
||||||
NCSARequestLog requestLog = new NCSARequestLog();
|
AsyncRequestLogWriter logWriter = new AsyncRequestLogWriter(jetty_home + "/logs/yyyy_mm_dd.request.log");
|
||||||
requestLog.setFilename(jetty_home + "/logs/yyyy_mm_dd.request.log");
|
CustomRequestLog requestLog = new CustomRequestLog(logWriter, CustomRequestLog.EXTENDED_NCSA_FORMAT + " \"%C\"");
|
||||||
requestLog.setFilenameDateFormat("yyyy_MM_dd");
|
logWriter.setFilenameDateFormat("yyyy_MM_dd");
|
||||||
requestLog.setRetainDays(90);
|
logWriter.setRetainDays(90);
|
||||||
requestLog.setAppend(true);
|
logWriter.setTimeZone("GMT");
|
||||||
requestLog.setExtended(true);
|
|
||||||
requestLog.setLogCookies(false);
|
|
||||||
requestLog.setLogTimeZone("GMT");
|
|
||||||
server.setRequestLog(requestLog);
|
server.setRequestLog(requestLog);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.server.CustomRequestLog;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.NCSARequestLog;
|
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
|
@ -117,8 +117,7 @@ public class ManyHandlers
|
||||||
|
|
||||||
// configure request logging
|
// configure request logging
|
||||||
File requestLogFile = File.createTempFile("demo", "log");
|
File requestLogFile = File.createTempFile("demo", "log");
|
||||||
NCSARequestLog ncsaLog = new NCSARequestLog(
|
CustomRequestLog ncsaLog = new CustomRequestLog(requestLogFile.getAbsolutePath());
|
||||||
requestLogFile.getAbsolutePath());
|
|
||||||
server.setRequestLog(ncsaLog);
|
server.setRequestLog(ncsaLog);
|
||||||
|
|
||||||
// create the handler collections
|
// create the handler collections
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<Arg>
|
<Arg>
|
||||||
<New class="org.eclipse.jetty.server.AsyncRequestLogWriter">
|
<New class="org.eclipse.jetty.server.AsyncRequestLogWriter">
|
||||||
<Arg><Property name="jetty.base" default="." />/<Property>
|
<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>
|
<Default><Property name="jetty.requestlog.dir" default="logs"/>/yyyy_mm_dd.request.log</Default>
|
||||||
</Property></Arg>
|
</Property></Arg>
|
||||||
<Arg/>
|
<Arg/>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<!-- Format String -->
|
<!-- Format String -->
|
||||||
<Arg>
|
<Arg>
|
||||||
<Property name="jetty.requestlog.formatString">
|
<Property name="jetty.customrequestlog.formatString">
|
||||||
<Default>
|
<Default>
|
||||||
<Get class="org.eclipse.jetty.server.CustomRequestLog" name="EXTENDED_NCSA_FORMAT"/>
|
<Get class="org.eclipse.jetty.server.CustomRequestLog" name="EXTENDED_NCSA_FORMAT"/>
|
||||||
</Default>
|
</Default>
|
||||||
|
|
|
@ -34,8 +34,8 @@ logs/
|
||||||
## Whether to append to existing file
|
## Whether to append to existing file
|
||||||
# jetty.requestlog.append=false
|
# jetty.requestlog.append=false
|
||||||
|
|
||||||
## Timezone of the log entries
|
## Timezone of the log file rollover
|
||||||
# jetty.requestlog.timezone=GMT
|
# jetty.requestlog.timezone=GMT
|
||||||
|
|
||||||
## Format string
|
## 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);
|
this(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AsyncRequestLogWriter(String filename)
|
||||||
|
{
|
||||||
|
this(filename, null);
|
||||||
|
}
|
||||||
|
|
||||||
public AsyncRequestLogWriter(String filename, BlockingQueue<String> queue)
|
public AsyncRequestLogWriter(String filename, BlockingQueue<String> queue)
|
||||||
{
|
{
|
||||||
super(filename);
|
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.
|
* Writes the request and response information to the output stream.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,13 +18,24 @@
|
||||||
|
|
||||||
package org.eclipse.jetty;
|
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.jmx.MBeanContainer;
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
|
import org.eclipse.jetty.server.CustomRequestLog;
|
||||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.HttpConfiguration;
|
import org.eclipse.jetty.server.HttpConfiguration;
|
||||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||||
import org.eclipse.jetty.server.NCSARequestLog;
|
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
@ -47,16 +58,6 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
import org.eclipse.jetty.webapp.WebInfConfiguration;
|
import org.eclipse.jetty.webapp.WebInfConfiguration;
|
||||||
import org.junit.jupiter.api.Disabled;
|
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")
|
@Disabled("Not a test case")
|
||||||
public class TestServer
|
public class TestServer
|
||||||
{
|
{
|
||||||
|
@ -123,8 +124,7 @@ public class TestServer
|
||||||
server.addBean(login);
|
server.addBean(login);
|
||||||
|
|
||||||
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");
|
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");
|
||||||
NCSARequestLog requestLog = new NCSARequestLog(log.toString());
|
CustomRequestLog requestLog = new CustomRequestLog(log.toString());
|
||||||
requestLog.setExtended(false);
|
|
||||||
server.setRequestLog(requestLog);
|
server.setRequestLog(requestLog);
|
||||||
|
|
||||||
server.setStopAtShutdown(true);
|
server.setStopAtShutdown(true);
|
||||||
|
|
Loading…
Reference in New Issue