org.apache.synapse.transport.http.access

## Class AccessLogger

- java.lang.Object
- - org.apache.synapse.transport.http.access.AccessLogger

-     public class AccessLogger
      extends java.lang.Object

  Class that logs the Http Accesses to the access log files. Code segment borrowed from Apache Tomcat's org.apache.catalina.valves.AccessLogValve with thanks.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ACCESS_LOG_ID`
    `protected java.io.File` | `currentLogFile` The current log file we are writing to.
    `protected java.text.SimpleDateFormat` | `fileDateFormatter` A date formatter to format a Date into a date in the given file format
    `static java.lang.String` | `NHTTP_LOG_DIRECTORY`
    `protected java.io.PrintWriter` | `writer` The PrintWriter to which we are currently logging, if any.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccessLogger(org.apache.commons.logging.Log log)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `handleThrowable(java.lang.Throwable t)` Checks whether the supplied Throwable is one that needs to be re-thrown and swallows all others.
    `protected void` | `initOpen()`
    `void` | `log(java.lang.String message)` Log the specified message to the log file, switching files if the date has changed since the previous log call.
    `protected void` | `open()` Open the new log file for the date specified by `dateStamp`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NHTTP_LOG_DIRECTORY

          public static final java.lang.String NHTTP_LOG_DIRECTORY

      See Also:
        Constant Field Values

    - #### ACCESS_LOG_ID

          public static final java.lang.String ACCESS_LOG_ID

      See Also:
        Constant Field Values

    - #### fileDateFormatter

          protected java.text.SimpleDateFormat fileDateFormatter

      A date formatter to format a Date into a date in the given file format

    - #### writer

          protected java.io.PrintWriter writer

      The PrintWriter to which we are currently logging, if any.

    - #### currentLogFile

          protected java.io.File currentLogFile

      The current log file we are writing to. Helpful when checkExists is true.

  - ### Constructor Detail

    - #### AccessLogger

          public AccessLogger(org.apache.commons.logging.Log log)

  - ### Method Detail

    - #### log

          public void log(java.lang.String message)

      Log the specified message to the log file, switching files if the date has changed since the previous log call.
      Parameters:
        `message` - Message to be logged

    - #### initOpen

          protected void initOpen()

    - #### open

          protected void open()

      Open the new log file for the date specified by `dateStamp`.

    - #### handleThrowable

          public static void handleThrowable(java.lang.Throwable t)

      Checks whether the supplied Throwable is one that needs to be re-thrown and swallows all others.
      Parameters:
        `t` - the Throwable to check

Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.