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 usingRolloverFileOutputStream
.
-
-
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
-
-
Constructor Summary
Constructors Constructor Description RequestLogWriter()
RequestLogWriter(java.lang.String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
doStart()
protected void
doStop()
java.lang.String
getDatedFilename()
Retrieve the file name of the request log with the expanded date wildcard if the output is written to the disk usingRolloverFileOutputStream
.java.lang.String
getFileName()
Retrieve the output file name of the request log.java.lang.String
getFilenameDateFormat()
Retrieve the file name date format string.int
getRetainDays()
Retrieve the number of days before rotated log files are deleted.java.lang.String
getTimeZone()
boolean
isAppend()
Retrieve append to log flag.protected boolean
isEnabled()
Deprecated.void
setAppend(boolean append)
Set append to log flag.void
setFilename(java.lang.String filename)
Set the output file name of the request log.void
setFilenameDateFormat(java.lang.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(java.lang.String timeZone)
void
write(java.lang.String requestEntry)
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
-
-
-
Method Detail
-
setFilename
public void setFilename(java.lang.String filename)
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
@ManagedAttribute("filename") public java.lang.String getFileName()
Retrieve the output file name of the request log.- Returns:
- file name of the request log
-
getDatedFilename
@ManagedAttribute("dated filename") public java.lang.String 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
-
isEnabled
@Deprecated protected boolean isEnabled()
Deprecated.
-
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
@ManagedAttribute("number of days to keep a log file") public int 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
@ManagedAttribute("if request log file will be appended after restart") public boolean isAppend()
Retrieve append to log flag.- Returns:
- value of the flag
-
setFilenameDateFormat
public void setFilenameDateFormat(java.lang.String logFileDateFormat)
Set the log file name date format.- Parameters:
logFileDateFormat
- format string that is passed toRolloverFileOutputStream
- See Also:
RolloverFileOutputStream(String, boolean, int, TimeZone, String, String)
-
getFilenameDateFormat
@ManagedAttribute("log file name date format") public java.lang.String getFilenameDateFormat()
Retrieve the file name date format string.- Returns:
- the log File Date Format
-
write
public void write(java.lang.String requestEntry) throws java.io.IOException
- Specified by:
write
in interfaceRequestLog.Writer
- Throws:
java.io.IOException
-
doStart
protected void doStart() throws java.lang.Exception
- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
java.lang.Exception
-
setTimeZone
public void setTimeZone(java.lang.String timeZone)
-
getTimeZone
@ManagedAttribute("timezone of the log") public java.lang.String getTimeZone()
-
doStop
protected void doStop() throws java.lang.Exception
- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
java.lang.Exception
-
-