public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implements RequestLog
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.AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Constructor and Description |
---|
AbstractNCSARequestLog() |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
Set up request logging and open log file.
|
protected void |
doStop() |
String[] |
getIgnorePaths()
Retrieve the request paths that will not be logged.
|
boolean |
getLogCookies()
Retrieve log cookies flag
|
String |
getLogDateFormat()
Retrieve the timestamp format string for request log entries.
|
boolean |
getLogLatency()
Retrieve log request processing time flag.
|
Locale |
getLogLocale()
Retrieve the locale of the request log.
|
boolean |
getLogServer()
Retrieve log hostname flag.
|
String |
getLogTimeZone()
Retrieve the timezone of the request log.
|
boolean |
getPreferProxiedForAddress()
Retrieved log X-Forwarded-For IP address flag.
|
protected abstract boolean |
isEnabled()
Is logging enabled
|
boolean |
isExtended()
Retrieve the extended request log format flag.
|
boolean |
isLogDispatch()
Deprecated.
use
StatisticsHandler |
void |
log(Request request,
Response response)
Writes the request and response information to the output stream.
|
protected void |
logExtended(Request request,
Response response,
StringBuilder b)
Writes extended request and response information to the output stream.
|
void |
setExtended(boolean extended)
Set the extended request log format flag.
|
void |
setIgnorePaths(String[] ignorePaths)
Set request paths that will not be logged.
|
void |
setLogCookies(boolean logCookies)
Controls logging of the request cookies.
|
void |
setLogDateFormat(String format)
Set the timestamp format for request log entries in the file.
|
void |
setLogDispatch(boolean value)
Deprecated.
use
StatisticsHandler |
void |
setLogLatency(boolean logLatency)
Controls logging of request processing time.
|
void |
setLogLocale(Locale logLocale)
Set the locale of the request log.
|
void |
setLogServer(boolean logServer)
Controls logging of the request hostname.
|
void |
setLogTimeZone(String tz)
Set the timezone of the request log.
|
void |
setPreferProxiedForAddress(boolean preferProxiedForAddress)
Controls whether the actual IP address of the connection or the IP address from the X-Forwarded-For header will
be logged.
|
abstract void |
write(String requestEntry)
Write requestEntry out.
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
protected static final Logger LOG
protected abstract boolean isEnabled()
public abstract void write(String requestEntry) throws IOException
IOException
public void log(Request request, Response response)
log
in interface RequestLog
RequestLog.log(org.eclipse.jetty.server.Request,
org.eclipse.jetty.server.Response)
protected void logExtended(Request request, Response response, StringBuilder b) throws IOException
request
- request objectresponse
- response objectb
- StringBuilder to write toIOException
public void setIgnorePaths(String[] ignorePaths)
ignorePaths
- array of request pathspublic String[] getIgnorePaths()
public void setLogCookies(boolean logCookies)
logCookies
- true - values of request cookies will be logged, false - values of request cookies will not be
loggedpublic boolean getLogCookies()
public void setLogServer(boolean logServer)
logServer
- true - request hostname will be logged, false - request hostname will not be loggedpublic boolean getLogServer()
public void setLogLatency(boolean logLatency)
logLatency
- true - request processing time will be logged false - request processing time will not be
loggedpublic boolean getLogLatency()
public void setLogDispatch(boolean value)
StatisticsHandler
public boolean isLogDispatch()
StatisticsHandler
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
preferProxiedForAddress
- true - IP address from header will be logged, false - IP address from the
connection will be loggedpublic boolean getPreferProxiedForAddress()
public void setExtended(boolean extended)
extended
- true - log the extended request information, false - do not log the extended request information@ManagedAttribute(value="use extended NCSA format") public boolean isExtended()
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
AbstractLifeCycle.doStart()
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public void setLogDateFormat(String format)
format
- timestamp format stringpublic String getLogDateFormat()
public void setLogLocale(Locale logLocale)
logLocale
- locale objectpublic Locale getLogLocale()
public void setLogTimeZone(String tz)
tz
- timezone string@ManagedAttribute(value="the timezone") public String getLogTimeZone()
Copyright © 1995-2015 Webtide. All Rights Reserved.