RequestLog
NCSARequestLog
, Slf4jRequestLog
public abstract class AbstractNCSARequestLog extends org.eclipse.jetty.util.component.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.Modifier and Type | Field | Description |
---|---|---|
protected static org.eclipse.jetty.util.log.Logger |
LOG |
Constructor | Description |
---|---|
AbstractNCSARequestLog() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
doStart() |
Set up request logging and open log file.
|
protected void |
doStop() |
|
java.lang.String[] |
getIgnorePaths() |
Retrieve the request paths that will not be logged.
|
boolean |
getLogCookies() |
Retrieve log cookies flag
|
java.lang.String |
getLogDateFormat() |
Retrieve the timestamp format string for request log entries.
|
boolean |
getLogLatency() |
Retrieve log request processing time flag.
|
java.util.Locale |
getLogLocale() |
Retrieve the locale of the request log.
|
boolean |
getLogServer() |
Retrieve log hostname flag.
|
java.lang.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.
|
void |
log(Request request,
Response response) |
Writes the request and response information to the output stream.
|
protected void |
logExtended(java.lang.StringBuilder b,
Request request,
Response response) |
Writes extended request and response information to the output stream.
|
void |
setExtended(boolean extended) |
Set the extended request log format flag.
|
void |
setIgnorePaths(java.lang.String[] ignorePaths) |
Set request paths that will not be logged.
|
void |
setLogCookies(boolean logCookies) |
Controls logging of the request cookies.
|
void |
setLogDateFormat(java.lang.String format) |
Set the timestamp format for request log entries in the file.
|
void |
setLogDispatch(boolean value) |
Deprecated.
|
void |
setLogLatency(boolean logLatency) |
Controls logging of request processing time.
|
void |
setLogLocale(java.util.Locale logLocale) |
Set the locale of the request log.
|
void |
setLogServer(boolean logServer) |
Controls logging of the request hostname.
|
void |
setLogTimeZone(java.lang.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(java.lang.String requestEntry) |
Write requestEntry out.
|
protected abstract boolean isEnabled()
public abstract void write(java.lang.String requestEntry) throws java.io.IOException
requestEntry
- the request entryjava.io.IOException
- if unable to write the entrypublic void log(Request request, Response response)
log
in interface RequestLog
request
- The request to log.response
- The response to log. Note that for some requests
the response instance may not have been fully populated (Eg 400 bad request
responses are sent without a servlet response object). Thus for basic
log information it is best to consult Response.getCommittedMetaData()
and Response.getHttpChannel()
directly.RequestLog.log(Request, Response)
protected void logExtended(java.lang.StringBuilder b, Request request, Response response) throws java.io.IOException
b
- StringBuilder to write torequest
- request objectresponse
- response objectjava.io.IOException
- if unable to log the extended informationpublic void setIgnorePaths(java.lang.String[] ignorePaths)
ignorePaths
- array of request pathspublic java.lang.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()
@Deprecated public void setLogDispatch(boolean value)
StatisticsHandler
value
- true to log dispatch@Deprecated 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("use extended NCSA format") public boolean isExtended()
protected void doStart() throws java.lang.Exception
doStart
in class org.eclipse.jetty.util.component.AbstractLifeCycle
java.lang.Exception
AbstractLifeCycle.doStart()
protected void doStop() throws java.lang.Exception
doStop
in class org.eclipse.jetty.util.component.AbstractLifeCycle
java.lang.Exception
public void setLogDateFormat(java.lang.String format)
format
- timestamp format stringpublic java.lang.String getLogDateFormat()
public void setLogLocale(java.util.Locale logLocale)
logLocale
- locale objectpublic java.util.Locale getLogLocale()
public void setLogTimeZone(java.lang.String tz)
tz
- timezone string@ManagedAttribute("the timezone") public java.lang.String getLogTimeZone()
Copyright © 1995–2018 Webtide. All rights reserved.