net.i2p.jetty

## Class I2PRequestLog

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - net.i2p.jetty.I2PRequestLog

- All Implemented Interfaces:
    RequestLog, LifeCycle

      public class I2PRequestLog
      extends 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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PRequestLog()`
    `I2PRequestLog(String filename)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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)`

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### 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`

  - ### Method Detail

    - #### doStart

          protected void doStart()
                          throws Exception

      Overrides:
        `doStart` in class `AbstractLifeCycle`
      Throws:
        `Exception`

    - #### doStop

          protected void doStop()
                         throws Exception

      Overrides:
        `doStop` in class `AbstractLifeCycle`
      Throws:
        `Exception`

    - #### getDatedFilename

          public String getDatedFilename()

    - #### getFilename

          public String getFilename()

    - #### getFilenameDateFormat

          public String getFilenameDateFormat()

      Returns:
        the log File Date Format

    - #### getIgnorePaths

          public String[] getIgnorePaths()

    - #### getLogCookies

          public boolean getLogCookies()

    - #### getLogDateFormat

          public String getLogDateFormat()

    - #### getLogLatency

          public boolean getLogLatency()

    - #### getLogLocale

          public Locale getLogLocale()

    - #### getLogServer

          public boolean getLogServer()

    - #### getLogTimeZone

          public String getLogTimeZone()

    - #### getRetainDays

          public int getRetainDays()

    - #### isAppend

          public boolean isAppend()

    - #### isExtended

          public boolean isExtended()

    - #### 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`

    - #### setAppend

          public void setAppend(boolean append)

    - #### setB64

          public void setB64(boolean b64)

      Parameters:
        `b64` - true to enable base 64 logging. False for base 32 logging. Default false.

    - #### setExtended

          public void setExtended(boolean extended)

    - #### setFilename

          public void setFilename(String filename)

      Parameters:
        `filename` - The filename for the request log. This may be in the format expected by `RolloverFileOutputStream`

    - #### 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

    - #### setIgnorePaths

          public void setIgnorePaths(String[] ignorePaths)

    - #### setLogCookies

          public void setLogCookies(boolean logCookies)

    - #### 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.

    - #### setLogLatency

          public void setLogLatency(boolean logLatency)

    - #### setLogLocale

          public void setLogLocale(Locale logLocale)

    - #### setLogServer

          public void setLogServer(boolean logServer)

    - #### setLogTimeZone

          public void setLogTimeZone(String tz)

    - #### setPreferProxiedForAddress

          public void setPreferProxiedForAddress(boolean preferProxiedForAddress)

    - #### setRetainDays

          public void setRetainDays(int retainDays)