public abstract class AccessLogFormatter extends Object
Modifier and Type | Field and 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 and Description |
---|
AccessLogFormatter()
Constructor.
|
Modifier and Type | Method and 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?
|
protected static final String SPACE
protected volatile ThreadLocal<SimpleDateFormat> dayFormatter
protected volatile ThreadLocal<SimpleDateFormat> monthFormatter
protected volatile ThreadLocal<SimpleDateFormat> yearFormatter
protected volatile ThreadLocal<SimpleDateFormat> timeFormatter
protected String timeZone
protected TimeZone tz
protected boolean needTimeTaken
public AccessLogFormatter()
public abstract void appendLogEntry(Request request, Response response, CharBuffer charBuffer)
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 infoprotected Date getDate()
protected String calculateTimeZoneOffset(long offset)
protected String lookup(String month)
month
- Month number ("01" .. "12").public boolean needTimeTaken()
Copyright © 2021. All rights reserved.