Class RequestLogWriter

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.RequestLogWriter
All Implemented Interfaces:
RequestLog.Writer, org.eclipse.jetty.util.component.LifeCycle
Direct Known Subclasses:
AsyncRequestLogWriter

@ManagedObject("Request Log writer which writes to file") public class RequestLogWriter extends org.eclipse.jetty.util.component.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

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

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

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

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

    FAILED, STARTED, STARTING, STOPPED, STOPPING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
    Retrieve the file name of the request log with the expanded date wildcard if the output is written to the disk using RolloverFileOutputStream.
    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
    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
    write(String requestEntry)
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RequestLogWriter

      public RequestLogWriter()
    • RequestLogWriter

      public RequestLogWriter(String filename)
  • Method Details

    • setFilename

      public void setFilename(String filename)
      Set the output file name of the request log. The file name may be in the format expected by RolloverFileOutputStream.
      Parameters:
      filename - file name of the request log
    • getFileName

      @ManagedAttribute("filename") public String getFileName()
      Retrieve the output file name of the request log.
      Returns:
      file name of the request log
    • getDatedFilename

      @ManagedAttribute("dated filename") public String getDatedFilename()
      Retrieve the file name of the request log with the expanded date wildcard if the output is written to the disk using RolloverFileOutputStream.
      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

      @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(String logFileDateFormat)
      Set the log file name date format.
      Parameters:
      logFileDateFormat - format string that is passed to RolloverFileOutputStream
      See Also:
      • RolloverFileOutputStream(String, boolean, int, TimeZone, String, String)
    • getFilenameDateFormat

      @ManagedAttribute("log file name date format") public String getFilenameDateFormat()
      Retrieve the file name date format string.
      Returns:
      the log File Date Format
    • write

      public void write(String requestEntry) throws IOException
      Specified by:
      write in interface RequestLog.Writer
      Throws:
      IOException
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception
    • setTimeZone

      public void setTimeZone(String timeZone)
    • getTimeZone

      @ManagedAttribute("timezone of the log") public String getTimeZone()
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.util.component.AbstractLifeCycle
      Throws:
      Exception