Top Description Fields Constructors Methods
org.mortbay.jetty

public Class NCSARequestLog

extends AbstractLifeCycle
implements RequestLog
Class Inheritance
All Implemented Interfaces
org.mortbay.jetty.RequestLog, org.mortbay.component.LifeCycle
Imports
java.io.IOException, .OutputStream, .OutputStreamWriter, .Writer, java.util.ArrayList, .Locale, .TimeZone, javax.servlet.http.Cookie, org.mortbay.component.AbstractLifeCycle, org.mortbay.jetty.servlet.PathMap, org.mortbay.log.Log, org.mortbay.util.DateCache, .RolloverFileOutputStream, .StringUtil, .TypeUtil, .Utf8StringBuffer

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.
Authors
Greg Wilkins, Nigel Canonizado

Field Summary

Modifier and TypeField and Description
private boolean
private transient ArrayList<E>
private boolean
private transient char[]
private boolean
private String
private String
private transient OutputStream
private transient PathMap
private String[]
private boolean
private transient DateCache
private String
private boolean
private Locale
private boolean
private String
private transient OutputStream
private boolean
private int
private transient Writer
Inherited from org.mortbay.component.AbstractLifeCycle:
_listeners

Constructor Summary

AccessConstructor and Description
public
public
NCSARequestLog(String
The filename for the request log. This may be in the format expected by RolloverFileOutputStream
filename
)

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
public String
public String
public String

Returns:

the log File Date Format
getFilenameDateFormat
()

public String[]
public boolean
public String
public boolean
public Locale
public boolean
public String
public int
public boolean
public boolean
public void
log(Request request, Response response)

Implements org.mortbay.jetty.RequestLog.log.

protected void
logExtended(Request request, Response response, Writer writer)

public void
setAppend(boolean append)

public void
setExtended(boolean extended)

public void
setFilename(String
The filename for the request log. This may be in the format expected by RolloverFileOutputStream
filename
)

public void
setFilenameDateFormat(String
the logFileDateFormat to pass to RolloverFileOutputStream
logFileDateFormat
)

Set the log file date format.

public void
setIgnorePaths(String[] ignorePaths)

public void
setLogCookies(boolean logCookies)

public void
setLogDateFormat(String
Format for the timestamps in the log file. If not set, the pre-formated request timestamp is used.
format
)

public void
setLogLatency(boolean logLatency)

public void
setLogLocale(Locale logLocale)

public void
setLogServer(boolean logServer)

public void
public void
setPreferProxiedForAddress(boolean preferProxiedForAddress)

public void
setRetainDays(int retainDays)

Inherited from org.mortbay.component.AbstractLifeCycle:
addLifeCycleListenerisFailedisRunningisStartedisStartingisStoppedisStoppingremoveLifeCycleListenerstartstop

Field Detail

_appendback to summary
private boolean _append
_buffersback to summary
private transient ArrayList<E> _buffers
_closeOutback to summary
private boolean _closeOut
_copyback to summary
private transient char[] _copy
_extendedback to summary
private boolean _extended
_filenameback to summary
private String _filename
_filenameDateFormatback to summary
private String _filenameDateFormat
_fileOutback to summary
private transient OutputStream _fileOut
_ignorePathMapback to summary
private transient PathMap _ignorePathMap
_ignorePathsback to summary
private String[] _ignorePaths
_logCookiesback to summary
private boolean _logCookies
_logDateCacheback to summary
private transient DateCache _logDateCache
_logDateFormatback to summary
private String _logDateFormat
_logLatencyback to summary
private boolean _logLatency
_logLocaleback to summary
private Locale _logLocale
_logServerback to summary
private boolean _logServer
_logTimeZoneback to summary
private String _logTimeZone
_outback to summary
private transient OutputStream _out
_preferProxiedForAddressback to summary
private boolean _preferProxiedForAddress
_retainDaysback to summary
private int _retainDays
_writerback to summary
private transient Writer _writer

Constructor Detail

NCSARequestLogback to summary
public NCSARequestLog()
NCSARequestLogback to summary
public NCSARequestLog(String filename)
Parameters
filename:String

The filename for the request log. This may be in the format expected by RolloverFileOutputStream

Method Detail

doStartback to summary
protected void doStart() throws Exception

Overrides org.mortbay.component.AbstractLifeCycle.doStart.

doStopback to summary
protected void doStop() throws Exception

Overrides org.mortbay.component.AbstractLifeCycle.doStop.

getDatedFilenameback to summary
public String getDatedFilename()
getFilenameback to summary
public String getFilename()
getFilenameDateFormatback to summary
public String getFilenameDateFormat()
Returns:String

the log File Date Format

getIgnorePathsback to summary
public String[] getIgnorePaths()
getLogCookiesback to summary
public boolean getLogCookies()
getLogDateFormatback to summary
public String getLogDateFormat()
getLogLatencyback to summary
public boolean getLogLatency()
getLogLocaleback to summary
public Locale getLogLocale()
getLogServerback to summary
public boolean getLogServer()
getLogTimeZoneback to summary
public String getLogTimeZone()
getRetainDaysback to summary
public int getRetainDays()
isAppendback to summary
public boolean isAppend()
isExtendedback to summary
public boolean isExtended()
logback to summary
public void log(Request request, Response response)

Implements org.mortbay.jetty.RequestLog.log.

logExtendedback to summary
protected void logExtended(Request request, Response response, Writer writer) throws IOException
setAppendback to summary
public void setAppend(boolean append)
setExtendedback to summary
public void setExtended(boolean extended)
setFilenameback to summary
public void setFilename(String filename)
Parameters
filename:String

The filename for the request log. This may be in the format expected by RolloverFileOutputStream

setFilenameDateFormatback to summary
public void setFilenameDateFormat(String logFileDateFormat)

Set the log file date format.

Parameters
logFileDateFormat:String

the logFileDateFormat to pass to RolloverFileOutputStream

See Also
RolloverFileOutputStream#RolloverFileOutputStream(String, boolean, int, TimeZone, String, String)
setIgnorePathsback to summary
public void setIgnorePaths(String[] ignorePaths)
setLogCookiesback to summary
public void setLogCookies(boolean logCookies)
setLogDateFormatback to summary
public void setLogDateFormat(String format)
Parameters
format:String

Format for the timestamps in the log file. If not set, the pre-formated request timestamp is used.

setLogLatencyback to summary
public void setLogLatency(boolean logLatency)
setLogLocaleback to summary
public void setLogLocale(Locale logLocale)
setLogServerback to summary
public void setLogServer(boolean logServer)
setLogTimeZoneback to summary
public void setLogTimeZone(String tz)
setPreferProxiedForAddressback to summary
public void setPreferProxiedForAddress(boolean preferProxiedForAddress)
setRetainDaysback to summary
public void setRetainDays(int retainDays)