com.caucho.server.log
Class AccessLog

java.lang.Object
  extended by com.caucho.server.log.AbstractAccessLog
      extended by com.caucho.server.log.AccessLog
All Implemented Interfaces:
AlarmListener, java.util.EventListener
Direct Known Subclasses:
AccessLog

public class AccessLog
extends AbstractAccessLog
implements AlarmListener

Represents an log of every top-level request to the server.


Field Summary
static int BUFFER_SIZE
           
protected static L10N L
           
protected static java.util.logging.Logger log
           
 
Fields inherited from class com.caucho.server.log.AbstractAccessLog
_path, _pathFormat
 
Constructor Summary
AccessLog()
           
 
Method Summary
 void addExclude(java.util.regex.Pattern pattern)
          Adds an exclusion pattern.
 void destroy()
          Closes the log, flushing the results.
 void flush()
          Flushes the log.
 void handleAlarm(Alarm alarm)
          The alarm listener.
 void init()
          Initialize the log.
 void log(HttpServletRequest req, HttpServletResponse res, ServletContext application)
          Logs a request using the current format.
 void setArchiveFormat(java.lang.String format)
          Sets the archive name format
 void setAutoFlush(boolean isAutoFlush)
          Sets the auto-flush attribute.
 void setAutoFlushTime(Period period)
          Sets the autoFlushTime
 void setFormat(java.lang.String format)
          Sets the access log format.
 void setPath(Path path)
          Sets the log path
 void setPathFormat(java.lang.String pathFormat)
          Sets the formatted path.
 void setRolloverCheckTime(Period period)
          Sets how often the log rollover will be checked.
 void setRolloverCount(int count)
          Sets the maximum number of rolled logs.
 void setRolloverCron(CronType cron)
          Sets the log rollover cron
 void setRolloverPeriod(Period period)
          Sets the log rollover period, rounded up to the nearest hour.
 void setRolloverSize(Bytes bytes)
          Sets the log rollover size, rounded up to the megabyte.
 void setSharedBuffer(boolean isSharedBuffer)
          Sets the shared buffer attribute.
 
Methods inherited from class com.caucho.server.log.AbstractAccessLog
addInit, getPath, getPathFormat, isHostnameDnsLookup, setHostnameDnsLookup, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

L

protected static final L10N L

log

protected static final java.util.logging.Logger log

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

AccessLog

public AccessLog()
Method Detail

setFormat

public void setFormat(java.lang.String format)
Sets the access log format.


setPath

public void setPath(Path path)
Sets the log path

Overrides:
setPath in class AbstractAccessLog

setPathFormat

@Configurable
public void setPathFormat(java.lang.String pathFormat)
                   throws ConfigException
Sets the formatted path.

Overrides:
setPathFormat in class AbstractAccessLog
Throws:
ConfigException

setArchiveFormat

@Configurable
public void setArchiveFormat(java.lang.String format)
Sets the archive name format


setRolloverCount

@Configurable
public void setRolloverCount(int count)
Sets the maximum number of rolled logs.

Parameters:
count - maximum count of the log file

setRolloverCron

@Configurable
public void setRolloverCron(CronType cron)
Sets the log rollover cron

Parameters:
cron - the cron string for rollover times

setRolloverPeriod

@Configurable
public void setRolloverPeriod(Period period)
Sets the log rollover period, rounded up to the nearest hour.

Parameters:
period - the new rollover period in milliseconds.

setRolloverSize

@Configurable
public void setRolloverSize(Bytes bytes)
Sets the log rollover size, rounded up to the megabyte.

Parameters:
size - maximum size of the log file

setRolloverCheckTime

@Configurable
public void setRolloverCheckTime(Period period)
Sets how often the log rollover will be checked.

Parameters:
period - how often the log rollover will be checked.

setAutoFlush

@Configurable
public void setAutoFlush(boolean isAutoFlush)
Sets the auto-flush attribute.


setAutoFlushTime

public void setAutoFlushTime(Period period)
Sets the autoFlushTime


setSharedBuffer

public void setSharedBuffer(boolean isSharedBuffer)
Sets the shared buffer attribute.


addExclude

@Configurable
public void addExclude(java.util.regex.Pattern pattern)
Adds an exclusion pattern.


init

@PostConstruct
public void init()
          throws ServletException,
                 java.io.IOException
Initialize the log.

Overrides:
init in class AbstractAccessLog
Throws:
ServletException
java.io.IOException

log

public void log(HttpServletRequest req,
                HttpServletResponse res,
                ServletContext application)
         throws java.io.IOException
Logs a request using the current format.

Specified by:
log in class AbstractAccessLog
Parameters:
req - the servlet request.
res - the servlet response.
Throws:
java.io.IOException

flush

public void flush()
Flushes the log.

Overrides:
flush in class AbstractAccessLog

handleAlarm

public void handleAlarm(Alarm alarm)
The alarm listener.

Specified by:
handleAlarm in interface AlarmListener

destroy

public void destroy()
             throws java.io.IOException
Closes the log, flushing the results.

Overrides:
destroy in class AbstractAccessLog
Throws:
java.io.IOException