public class I2PRequestLog extends AbstractLifeCycle implements RequestLog
RequestLog
implementation 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.
** I2P Mods **
For Jetty 5, this extended NCSARequestLog to
override log() to put in the requestor's destination hash,
instead of 127.0.0.1,
which is placed in the X-I2P-DestHash field in the request headers
by I2PTunnelHTTPServer.
But we also had to modify NCSARequestLog to do so, to change private
fields to protected.
So that we will work with system Jetty 6 packages, we just copy the whole thing
and modify log() as required.AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Constructor and Description |
---|
I2PRequestLog() |
I2PRequestLog(String filename) |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
String |
getDatedFilename() |
String |
getFilename() |
String |
getFilenameDateFormat() |
String[] |
getIgnorePaths() |
boolean |
getLogCookies() |
String |
getLogDateFormat() |
boolean |
getLogLatency() |
Locale |
getLogLocale() |
boolean |
getLogServer() |
String |
getLogTimeZone() |
int |
getRetainDays() |
boolean |
isAppend() |
boolean |
isExtended() |
void |
log(Request request,
Response response) |
protected void |
logExtended(Request request,
Response response,
Writer writer) |
void |
setAppend(boolean append) |
void |
setB64(boolean b64) |
void |
setExtended(boolean extended) |
void |
setFilename(String filename) |
void |
setFilenameDateFormat(String logFileDateFormat)
Set the log file date format.
|
void |
setIgnorePaths(String[] ignorePaths) |
void |
setLogCookies(boolean logCookies) |
void |
setLogDateFormat(String format) |
void |
setLogLatency(boolean logLatency) |
void |
setLogLocale(Locale logLocale) |
void |
setLogServer(boolean logServer) |
void |
setLogTimeZone(String tz) |
void |
setPreferProxiedForAddress(boolean preferProxiedForAddress) |
void |
setRetainDays(int retainDays) |
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
public I2PRequestLog()
public I2PRequestLog(String filename)
filename
- The filename for the request log. This may be in the format expected by RolloverFileOutputStream
public void setFilename(String filename)
filename
- The filename for the request log. This may be in the format expected by RolloverFileOutputStream
public String getFilename()
public String getDatedFilename()
public void setLogDateFormat(String format)
format
- Format for the timestamps in the log file. If not set,
the pre-formated request timestamp is used.public String getLogDateFormat()
public void setLogLocale(Locale logLocale)
public Locale getLogLocale()
public void setLogTimeZone(String tz)
public String getLogTimeZone()
public void setRetainDays(int retainDays)
public int getRetainDays()
public void setExtended(boolean extended)
public boolean isExtended()
public void setAppend(boolean append)
public boolean isAppend()
public void setIgnorePaths(String[] ignorePaths)
public String[] getIgnorePaths()
public void setLogCookies(boolean logCookies)
public boolean getLogCookies()
public boolean getLogServer()
public void setLogServer(boolean logServer)
public void setLogLatency(boolean logLatency)
public boolean getLogLatency()
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
public void setB64(boolean b64)
b64
- true to enable base 64 logging. False for base 32 logging. Default false.public void log(Request request, Response response)
log
in interface RequestLog
protected void logExtended(Request request, Response response, Writer writer) throws IOException
IOException
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public String getFilenameDateFormat()
public void setFilenameDateFormat(String logFileDateFormat)
logFileDateFormat
- the logFileDateFormat to pass to RolloverFileOutputStream