Package com.sun.enterprise.web.accesslog
Class AccessLogFormatter
- java.lang.Object
-
- com.sun.enterprise.web.accesslog.AccessLogFormatter
-
- Direct Known Subclasses:
CommonAccessLogFormatterImpl
,DefaultAccessLogFormatterImpl
public abstract class AccessLogFormatter extends Object
Abstract class defining an interface for appending access log entries to the access log in a customized access log format.
-
-
Field Summary
Fields Modifier and Type Field Description protected ThreadLocal<SimpleDateFormat>
dayFormatter
ThreadLocal for a date formatter to format Dates into a day string in the format "dd".protected ThreadLocal<SimpleDateFormat>
monthFormatter
ThreadLocal for a date formatter to format a Date into a month string in the format "MM".protected boolean
needTimeTaken
protected static String
SPACE
When formatting log lines, we often use strings like this one (" ").protected ThreadLocal<SimpleDateFormat>
timeFormatter
ThreadLocal for a date formatter to format a Date into a time in the format "kk:mm:ss" (kk is a 24-hour representation of the hour).protected String
timeZone
The time zone relative to GMT.protected TimeZone
tz
protected ThreadLocal<SimpleDateFormat>
yearFormatter
ThreadLocal for a date formatter to format a Date into a year string in the format "yyyy".
-
Constructor Summary
Constructors Constructor Description AccessLogFormatter()
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
appendLogEntry(Request request, Response response, CharBuffer charBuffer)
Appends an access log entry line, with info obtained from the given request and response objects, to the given CharBuffer.protected String
calculateTimeZoneOffset(long offset)
protected Date
getDate()
This method returns a Date object that is accurate to within one second.protected String
lookup(String month)
Return the month abbreviation for the specified month, which must be a two-digit String.boolean
needTimeTaken()
Has the time-taken token been specified in the access log pattern?
-
-
-
Field Detail
-
SPACE
protected static final String SPACE
When formatting log lines, we often use strings like this one (" ").- See Also:
- Constant Field Values
-
dayFormatter
protected volatile ThreadLocal<SimpleDateFormat> dayFormatter
ThreadLocal for a date formatter to format Dates into a day string in the format "dd".
-
monthFormatter
protected volatile ThreadLocal<SimpleDateFormat> monthFormatter
ThreadLocal for a date formatter to format a Date into a month string in the format "MM".
-
yearFormatter
protected volatile ThreadLocal<SimpleDateFormat> yearFormatter
ThreadLocal for a date formatter to format a Date into a year string in the format "yyyy".
-
timeFormatter
protected volatile ThreadLocal<SimpleDateFormat> timeFormatter
ThreadLocal for a date formatter to format a Date into a time in the format "kk:mm:ss" (kk is a 24-hour representation of the hour).
-
timeZone
protected String timeZone
The time zone relative to GMT.
-
tz
protected TimeZone tz
-
needTimeTaken
protected boolean needTimeTaken
-
-
Method Detail
-
appendLogEntry
public abstract void appendLogEntry(Request request, Response response, CharBuffer charBuffer)
Appends an access log entry line, with info obtained from the given request and response objects, to the given CharBuffer.- Parameters:
request
- The request object from which to obtain access log inforesponse
- The response object from which to obtain access log infocharBuffer
- The CharBuffer to which to append access log info
-
getDate
protected Date getDate()
This method returns a Date object that is accurate to within one second. If a writerThread calls this method to get a Date and it's been less than 1 second since a new Date was created, this method simply gives out the same Date again so that the system doesn't spend time creating Date objects unnecessarily.
-
calculateTimeZoneOffset
protected String calculateTimeZoneOffset(long offset)
-
lookup
protected String lookup(String month)
Return the month abbreviation for the specified month, which must be a two-digit String.- Parameters:
month
- Month number ("01" .. "12").
-
needTimeTaken
public boolean needTimeTaken()
Has the time-taken token been specified in the access log pattern?- Returns:
- true if the time-taken token has been specified in the access log pattern, false otherwise.
-
-