Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
79fb4287bb
|
@ -33,12 +33,10 @@ import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base implementation of the {@link RequestLog} outputs logs in the pseudo-standard
|
* Base implementation of the {@link RequestLog} outputs logs in the pseudo-standard NCSA common log format.
|
||||||
* NCSA common log format. Configuration options allow a choice between the
|
* Configuration options allow a choice between the standard Common Log Format (as used in the 3 log format) and the
|
||||||
* standard Common Log Format (as used in the 3 log format) and the Combined Log
|
* Combined Log Format (single log format). This log format can be output by most web servers, and almost all web log
|
||||||
* Format (single log format). This log format can be output by most web
|
* analysis software can understand these formats.
|
||||||
* servers, and almost all web log analysis software can understand these
|
|
||||||
* formats.
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implements RequestLog
|
public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implements RequestLog
|
||||||
{
|
{
|
||||||
|
@ -67,22 +65,26 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
private String _logTimeZone = "GMT";
|
private String _logTimeZone = "GMT";
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is logging enabled
|
* Is logging enabled
|
||||||
*/
|
*/
|
||||||
protected abstract boolean isEnabled();
|
protected abstract boolean isEnabled();
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write requestEntry out. (to disk or slf4j log)
|
* Write requestEntry out. (to disk or slf4j log)
|
||||||
*/
|
*/
|
||||||
public abstract void write(String requestEntry) throws IOException;
|
public abstract void write(String requestEntry) throws IOException;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the request and response information to the output stream.
|
* Writes the request and response information to the output stream.
|
||||||
*
|
*
|
||||||
* @see org.eclipse.jetty.server.RequestLog#log(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response)
|
* @see org.eclipse.jetty.server.RequestLog#log(org.eclipse.jetty.server.Request,
|
||||||
|
* org.eclipse.jetty.server.Response)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void log(Request request, Response response)
|
public void log(Request request, Response response)
|
||||||
|
@ -134,17 +136,13 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
buf.append(' ');
|
buf.append(' ');
|
||||||
buf.append(request.getProtocol());
|
buf.append(request.getProtocol());
|
||||||
buf.append("\" ");
|
buf.append("\" ");
|
||||||
if (request.getHttpChannelState().isInitial())
|
|
||||||
{
|
|
||||||
int status = response.getStatus();
|
int status = response.getStatus();
|
||||||
if (status <= 0)
|
if (status <= 0)
|
||||||
status = 404;
|
status = 404;
|
||||||
buf.append((char)('0' + ((status / 100) % 10)));
|
buf.append((char)('0' + ((status / 100) % 10)));
|
||||||
buf.append((char)('0' + ((status / 10) % 10)));
|
buf.append((char)('0' + ((status / 10) % 10)));
|
||||||
buf.append((char)('0' + (status % 10)));
|
buf.append((char)('0' + (status % 10)));
|
||||||
}
|
|
||||||
else
|
|
||||||
buf.append("Async");
|
|
||||||
|
|
||||||
long responseLength = response.getLongContentLength();
|
long responseLength = response.getLongContentLength();
|
||||||
if (responseLength >= 0)
|
if (responseLength >= 0)
|
||||||
|
@ -214,6 +212,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes extended request and response information to the output stream.
|
* Writes extended request and response information to the output stream.
|
||||||
*
|
*
|
||||||
|
@ -248,7 +247,6 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set request paths that will not be logged.
|
* Set request paths that will not be logged.
|
||||||
*
|
*
|
||||||
|
@ -272,8 +270,8 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
/**
|
/**
|
||||||
* Controls logging of the request cookies.
|
* Controls logging of the request cookies.
|
||||||
*
|
*
|
||||||
* @param logCookies true - values of request cookies will be logged,
|
* @param logCookies true - values of request cookies will be logged, false - values of request cookies will not be
|
||||||
* false - values of request cookies will not be logged
|
* logged
|
||||||
*/
|
*/
|
||||||
public void setLogCookies(boolean logCookies)
|
public void setLogCookies(boolean logCookies)
|
||||||
{
|
{
|
||||||
|
@ -293,8 +291,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
/**
|
/**
|
||||||
* Controls logging of the request hostname.
|
* Controls logging of the request hostname.
|
||||||
*
|
*
|
||||||
* @param logServer true - request hostname will be logged,
|
* @param logServer true - request hostname will be logged, false - request hostname will not be logged
|
||||||
* false - request hostname will not be logged
|
|
||||||
*/
|
*/
|
||||||
public void setLogServer(boolean logServer)
|
public void setLogServer(boolean logServer)
|
||||||
{
|
{
|
||||||
|
@ -314,8 +311,8 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
/**
|
/**
|
||||||
* Controls logging of request processing time.
|
* Controls logging of request processing time.
|
||||||
*
|
*
|
||||||
* @param logLatency true - request processing time will be logged
|
* @param logLatency true - request processing time will be logged false - request processing time will not be
|
||||||
* false - request processing time will not be logged
|
* logged
|
||||||
*/
|
*/
|
||||||
public void setLogLatency(boolean logLatency)
|
public void setLogLatency(boolean logLatency)
|
||||||
{
|
{
|
||||||
|
@ -348,11 +345,11 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls whether the actual IP address of the connection or
|
* Controls whether the actual IP address of the connection or the IP address from the X-Forwarded-For header will
|
||||||
* the IP address from the X-Forwarded-For header will be logged.
|
* be logged.
|
||||||
*
|
*
|
||||||
* @param preferProxiedForAddress true - IP address from header will be logged,
|
* @param preferProxiedForAddress true - IP address from header will be logged, false - IP address from the
|
||||||
* false - IP address from the connection will be logged
|
* connection will be logged
|
||||||
*/
|
*/
|
||||||
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
|
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
|
||||||
{
|
{
|
||||||
|
@ -372,8 +369,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
/**
|
/**
|
||||||
* Set the extended request log format flag.
|
* Set the extended request log format flag.
|
||||||
*
|
*
|
||||||
* @param extended true - log the extended request information,
|
* @param extended true - log the extended request information, false - do not log the extended request information
|
||||||
* false - do not log the extended request information
|
|
||||||
*/
|
*/
|
||||||
public void setExtended(boolean extended)
|
public void setExtended(boolean extended)
|
||||||
{
|
{
|
||||||
|
@ -425,8 +421,8 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the timestamp format for request log entries in the file.
|
* Set the timestamp format for request log entries in the file. If this is not set, the pre-formated request
|
||||||
* If this is not set, the pre-formated request timestamp is used.
|
* timestamp is used.
|
||||||
*
|
*
|
||||||
* @param format timestamp format string
|
* @param format timestamp format string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue