Package org.eclipse.jetty.server
Class RequestLogWriter
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.RequestLogWriter
- All Implemented Interfaces:
RequestLog.Writer
,LifeCycle
- Direct Known Subclasses:
AsyncRequestLogWriter
@ManagedObject("Request Log writer which writes to file")
public class RequestLogWriter
extends AbstractLifeCycle
implements RequestLog.Writer
Writer which outputs pre-formatted request log strings to a file using
RolloverFileOutputStream
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
Method to override to start the lifecycleprotected void
doStop()
Method to override to stop the lifecycleRetrieve the file name of the request log with the expanded date wildcard if the output is written to the disk usingRolloverFileOutputStream
.Retrieve the output file name of the request log.Retrieve the file name date format string.int
Retrieve the number of days before rotated log files are deleted.boolean
isAppend()
Retrieve append to log flag.void
setAppend
(boolean append) Set append to log flag.void
setFilename
(String filename) Set the output file name of the request log.void
setFilenameDateFormat
(String logFileDateFormat) Set the log file name date format.void
setRetainDays
(int retainDays) Set the number of days before rotated log files are deleted.void
setTimeZone
(String timeZone) void
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toString
-
Constructor Details
-
RequestLogWriter
public RequestLogWriter() -
RequestLogWriter
-
-
Method Details
-
setFilename
Set the output file name of the request log. The file name may be in the format expected byRolloverFileOutputStream
.- Parameters:
filename
- file name of the request log
-
getFileName
Retrieve the output file name of the request log.- Returns:
- file name of the request log
-
getDatedFilename
Retrieve the file name of the request log with the expanded date wildcard if the output is written to the disk usingRolloverFileOutputStream
.- Returns:
- file name of the request log, or null if not applicable
-
setRetainDays
public void setRetainDays(int retainDays) Set the number of days before rotated log files are deleted.- Parameters:
retainDays
- number of days to keep a log file
-
getRetainDays
Retrieve the number of days before rotated log files are deleted.- Returns:
- number of days to keep a log file
-
setAppend
public void setAppend(boolean append) Set append to log flag.- Parameters:
append
- true - request log file will be appended after restart, false - request log file will be overwritten after restart
-
isAppend
Retrieve append to log flag.- Returns:
- value of the flag
-
setFilenameDateFormat
Set the log file name date format.- Parameters:
logFileDateFormat
- format string that is passed toRolloverFileOutputStream
- See Also:
-
getFilenameDateFormat
Retrieve the file name date format string.- Returns:
- the log File Date Format
-
write
- Specified by:
write
in interfaceRequestLog.Writer
- Throws:
IOException
-
doStart
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
setTimeZone
-
getTimeZone
-
doStop
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-