Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Greg Wilkins 2013-08-30 14:37:55 +10:00
commit 79fb4287bb
1 changed files with 45 additions and 49 deletions

View File

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