Merge pull request #4470 from eclipse/jetty-10.0.x-4460-custom_request_log_no_parameters
Fixes #4460 - Provide a parameterless CustomRequestLog.
This commit is contained in:
commit
b2907f85f3
|
@ -276,7 +276,7 @@ public class CustomRequestLog extends ContainerLifeCycle implements RequestLog
|
||||||
public static final String DEFAULT_DATE_FORMAT = "dd/MMM/yyyy:HH:mm:ss ZZZ";
|
public static final String DEFAULT_DATE_FORMAT = "dd/MMM/yyyy:HH:mm:ss ZZZ";
|
||||||
|
|
||||||
public static final String NCSA_FORMAT = "%{client}a - %u %t \"%r\" %s %O";
|
public static final String NCSA_FORMAT = "%{client}a - %u %t \"%r\" %s %O";
|
||||||
public static final String EXTENDED_NCSA_FORMAT = "%{client}a - %u %t \"%r\" %s %O \"%{Referer}i\" \"%{User-Agent}i\"";
|
public static final String EXTENDED_NCSA_FORMAT = NCSA_FORMAT + " \"%{Referer}i\" \"%{User-Agent}i\"";
|
||||||
|
|
||||||
private static ThreadLocal<StringBuilder> _buffers = ThreadLocal.withInitial(() -> new StringBuilder(256));
|
private static ThreadLocal<StringBuilder> _buffers = ThreadLocal.withInitial(() -> new StringBuilder(256));
|
||||||
|
|
||||||
|
@ -287,6 +287,21 @@ public class CustomRequestLog extends ContainerLifeCycle implements RequestLog
|
||||||
private final MethodHandle _logHandle;
|
private final MethodHandle _logHandle;
|
||||||
private final String _formatString;
|
private final String _formatString;
|
||||||
|
|
||||||
|
public CustomRequestLog()
|
||||||
|
{
|
||||||
|
this(new Slf4jRequestLogWriter(), EXTENDED_NCSA_FORMAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomRequestLog(String file)
|
||||||
|
{
|
||||||
|
this(file, EXTENDED_NCSA_FORMAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomRequestLog(String file, String format)
|
||||||
|
{
|
||||||
|
this(new RequestLogWriter(file), format);
|
||||||
|
}
|
||||||
|
|
||||||
public CustomRequestLog(RequestLog.Writer writer, String formatString)
|
public CustomRequestLog(RequestLog.Writer writer, String formatString)
|
||||||
{
|
{
|
||||||
_formatString = formatString;
|
_formatString = formatString;
|
||||||
|
@ -303,16 +318,6 @@ public class CustomRequestLog extends ContainerLifeCycle implements RequestLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomRequestLog(String file)
|
|
||||||
{
|
|
||||||
this(file, EXTENDED_NCSA_FORMAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomRequestLog(String file, String format)
|
|
||||||
{
|
|
||||||
this(new RequestLogWriter(file), format);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ManagedAttribute("The RequestLogWriter")
|
@ManagedAttribute("The RequestLogWriter")
|
||||||
public RequestLog.Writer getWriter()
|
public RequestLog.Writer getWriter()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue