Class EdalAbstractRequestLog

  • All Implemented Interfaces:
    org.eclipse.jetty.server.RequestLog, org.eclipse.jetty.util.component.LifeCycle
    Direct Known Subclasses:
    EdalRequestLog

    public abstract class EdalAbstractRequestLog
    extends org.eclipse.jetty.util.component.AbstractLifeCycle
    implements org.eclipse.jetty.server.RequestLog
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

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

        org.eclipse.jetty.util.component.LifeCycle.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.server.RequestLog

        org.eclipse.jetty.server.RequestLog.Collection, org.eclipse.jetty.server.RequestLog.Writer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.eclipse.jetty.util.log.Logger LOG  
      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
    • Method Summary

      Modifier and Type Method Description
      protected void doStart()
      Set up request logging and open log file.
      protected void doStop()  
      java.lang.String[] getIgnorePaths()
      Retrieve the request paths that will not be logged.
      boolean getLogCookies()
      Retrieve log cookies flag
      java.lang.String getLogDateFormat()
      Retrieve the timestamp format string for request log entries.
      boolean getLogLatency()
      Retrieve log request processing time flag.
      java.util.Locale getLogLocale()
      Retrieve the locale of the request log.
      boolean getLogServer()
      Retrieve log hostname flag.
      java.lang.String getLogTimeZone()
      Retrieve the timezone of the request log.
      boolean getPreferProxiedForAddress()
      Retrieved log X-Forwarded-For IP address flag.
      protected abstract boolean isEnabled()
      Is logging enabled
      boolean isExtended()
      Retrieve the extended request log format flag.
      boolean isLogDispatch()
      Deprecated.
      use StatisticsHandler
      void log​(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response)
      Writes the request and response information to the output stream.
      protected void logExtended​(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, java.lang.StringBuilder b)
      Writes extended request and response information to the output stream.
      void setExtended​(boolean extended)
      Set the extended request log format flag.
      void setIgnorePaths​(java.lang.String[] ignorePaths)
      Set request paths that will not be logged.
      void setLogCookies​(boolean logCookies)
      Controls logging of the request cookies.
      void setLogDateFormat​(java.lang.String format)
      Set the timestamp format for request log entries in the file.
      void setLogDispatch​(boolean value)
      Deprecated.
      use StatisticsHandler
      void setLogLatency​(boolean logLatency)
      Controls logging of request processing time.
      void setLogLocale​(java.util.Locale logLocale)
      Set the locale of the request log.
      void setLogServer​(boolean logServer)
      Controls logging of the request hostname.
      void setLogTimeZone​(java.lang.String tz)
      Set the timezone of the request log.
      void setPreferProxiedForAddress​(boolean preferProxiedForAddress)
      Controls whether the actual IP address of the connection or the IP address from the X-Forwarded-For header will be logged.
      abstract void write​(java.lang.String requestEntry)
      Write requestEntry out.
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • LOG

        protected static final org.eclipse.jetty.util.log.Logger LOG
    • Constructor Detail

      • EdalAbstractRequestLog

        public EdalAbstractRequestLog()
    • Method Detail

      • isEnabled

        protected abstract boolean isEnabled()
        Is logging enabled
        Returns:
        true if is enabled
      • write

        public abstract void write​(java.lang.String requestEntry)
                            throws java.io.IOException
        Write requestEntry out. (to disk or slf4j log)
        Parameters:
        requestEntry - the request entry string
        Throws:
        java.io.IOException - if failed to write
      • log

        public void log​(org.eclipse.jetty.server.Request request,
                        org.eclipse.jetty.server.Response response)
        Writes the request and response information to the output stream.
        Specified by:
        log in interface org.eclipse.jetty.server.RequestLog
        See Also:
        RequestLog.log(org.eclipse.jetty.server.Request, org.eclipse.jetty.server.Response)
      • logExtended

        protected void logExtended​(org.eclipse.jetty.server.Request request,
                                   org.eclipse.jetty.server.Response response,
                                   java.lang.StringBuilder b)
                            throws java.io.IOException
        Writes extended request and response information to the output stream.
        Parameters:
        request - request object
        response - response object
        b - StringBuilder to write to
        Throws:
        java.io.IOException - if failed
      • setIgnorePaths

        public void setIgnorePaths​(java.lang.String[] ignorePaths)
        Set request paths that will not be logged.
        Parameters:
        ignorePaths - array of request paths
      • getIgnorePaths

        public java.lang.String[] getIgnorePaths()
        Retrieve the request paths that will not be logged.
        Returns:
        array of request paths
      • setLogCookies

        public void setLogCookies​(boolean logCookies)
        Controls logging of the request cookies.
        Parameters:
        logCookies - true - values of request cookies will be logged, false - values of request cookies will not be logged
      • getLogCookies

        public boolean getLogCookies()
        Retrieve log cookies flag
        Returns:
        value of the flag
      • setLogServer

        public void setLogServer​(boolean logServer)
        Controls logging of the request hostname.
        Parameters:
        logServer - true - request hostname will be logged, false - request hostname will not be logged
      • getLogServer

        public boolean getLogServer()
        Retrieve log hostname flag.
        Returns:
        value of the flag
      • setLogLatency

        public void setLogLatency​(boolean logLatency)
        Controls logging of request processing time.
        Parameters:
        logLatency - true - request processing time will be logged false - request processing time will not be logged
      • getLogLatency

        public boolean getLogLatency()
        Retrieve log request processing time flag.
        Returns:
        value of the flag
      • setLogDispatch

        public void setLogDispatch​(boolean value)
        Deprecated.
        use StatisticsHandler
        Parameters:
        value - value to set
      • isLogDispatch

        public boolean isLogDispatch()
        Deprecated.
        use StatisticsHandler
        Returns:
        the set value
      • setPreferProxiedForAddress

        public void setPreferProxiedForAddress​(boolean preferProxiedForAddress)
        Controls whether the actual IP address of the connection or the IP address from the X-Forwarded-For header will be logged.
        Parameters:
        preferProxiedForAddress - true - IP address from header will be logged, false - IP address from the connection will be logged
      • getPreferProxiedForAddress

        public boolean getPreferProxiedForAddress()
        Retrieved log X-Forwarded-For IP address flag.
        Returns:
        value of the flag
      • setExtended

        public void setExtended​(boolean extended)
        Set the extended request log format flag.
        Parameters:
        extended - true - log the extended request information, false - do not log the extended request information
      • isExtended

        @ManagedAttribute("use extended NCSA format")
        public boolean isExtended()
        Retrieve the extended request log format flag.
        Returns:
        value of the flag
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Set up request logging and open log file.
        Overrides:
        doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
        Throws:
        java.lang.Exception
        See Also:
        AbstractLifeCycle.doStart()
      • doStop

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

        public void setLogDateFormat​(java.lang.String format)
        Set the timestamp format for request log entries in the file. If this is not set, the pre-formated request timestamp is used.
        Parameters:
        format - timestamp format string
      • getLogDateFormat

        public java.lang.String getLogDateFormat()
        Retrieve the timestamp format string for request log entries.
        Returns:
        timestamp format string.
      • setLogLocale

        public void setLogLocale​(java.util.Locale logLocale)
        Set the locale of the request log.
        Parameters:
        logLocale - locale object
      • getLogLocale

        public java.util.Locale getLogLocale()
        Retrieve the locale of the request log.
        Returns:
        locale object
      • setLogTimeZone

        public void setLogTimeZone​(java.lang.String tz)
        Set the timezone of the request log.
        Parameters:
        tz - timezone string
      • getLogTimeZone

        @ManagedAttribute("the timezone")
        public java.lang.String getLogTimeZone()
        Retrieve the timezone of the request log.
        Returns:
        timezone string