net.i2p.jetty
Class I2PRequestLog
java.lang.Object
org.mortbay.component.AbstractLifeCycle
net.i2p.jetty.I2PRequestLog
- All Implemented Interfaces:
- org.mortbay.component.LifeCycle, RequestLog
public class I2PRequestLog
- extends org.mortbay.component.AbstractLifeCycle
- implements RequestLog
This 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.
We leave the package as org.mortbay.http for compatibility with old
jetty.xml files.
- Author:
- Greg Wilkins, Nigel Canonizado
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle |
org.mortbay.component.LifeCycle.Listener |
Fields inherited from class org.mortbay.component.AbstractLifeCycle |
_listeners |
Methods inherited from class org.mortbay.component.AbstractLifeCycle |
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mortbay.component.LifeCycle |
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
I2PRequestLog
public I2PRequestLog()
I2PRequestLog
public I2PRequestLog(String filename)
- Parameters:
filename
- The filename for the request log. This may be in the format expected by RolloverFileOutputStream
setFilename
public void setFilename(String filename)
- Parameters:
filename
- The filename for the request log. This may be in the format expected by RolloverFileOutputStream
getFilename
public String getFilename()
getDatedFilename
public String getDatedFilename()
setLogDateFormat
public void setLogDateFormat(String format)
- Parameters:
format
- Format for the timestamps in the log file. If not set,
the pre-formated request timestamp is used.
getLogDateFormat
public String getLogDateFormat()
setLogLocale
public void setLogLocale(Locale logLocale)
getLogLocale
public Locale getLogLocale()
setLogTimeZone
public void setLogTimeZone(String tz)
getLogTimeZone
public String getLogTimeZone()
setRetainDays
public void setRetainDays(int retainDays)
getRetainDays
public int getRetainDays()
setExtended
public void setExtended(boolean extended)
isExtended
public boolean isExtended()
setAppend
public void setAppend(boolean append)
isAppend
public boolean isAppend()
setIgnorePaths
public void setIgnorePaths(String[] ignorePaths)
getIgnorePaths
public String[] getIgnorePaths()
setLogCookies
public void setLogCookies(boolean logCookies)
getLogCookies
public boolean getLogCookies()
getLogServer
public boolean getLogServer()
setLogServer
public void setLogServer(boolean logServer)
setLogLatency
public void setLogLatency(boolean logLatency)
getLogLatency
public boolean getLogLatency()
setPreferProxiedForAddress
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
log
public void log(Request request,
Response response)
- Specified by:
log
in interface RequestLog
logExtended
protected void logExtended(Request request,
Response response,
Writer writer)
throws IOException
- Throws:
IOException
doStart
protected void doStart()
throws Exception
- Overrides:
doStart
in class org.mortbay.component.AbstractLifeCycle
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Overrides:
doStop
in class org.mortbay.component.AbstractLifeCycle
- Throws:
Exception
getFilenameDateFormat
public String getFilenameDateFormat()
- Returns:
- the log File Date Format
setFilenameDateFormat
public void setFilenameDateFormat(String logFileDateFormat)
- Set the log file date format.
see RolloverFileOutputStream(String, boolean, int, TimeZone, String, String)
- Parameters:
logFileDateFormat
- the logFileDateFormat to pass to RolloverFileOutputStream