Fields Summary |
---|
protected static final String[] | monthsThe set of month abbreviations for log messages. |
protected static final String | SPACEWhen formatting log lines, we often use strings like this one (" "). |
protected SimpleDateFormat | dayFormatterA date formatter to format Dates into a day string in the format
"dd". |
protected SimpleDateFormat | monthFormatterA date formatter to format a Date into a month string in the format
"MM". |
protected SimpleDateFormat | yearFormatterA date formatter to format a Date into a year string in the format
"yyyy". |
protected SimpleDateFormat | timeFormatterA 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 | timeZoneThe time zone relative to GMT. |
protected TimeZone | tz |
protected boolean | needTimeTaken |
private Date | currentDateThe system time when we last updated the Date that this valve
uses for log lines. |
Methods Summary |
---|
public abstract void | appendLogEntry(org.apache.catalina.Request request, org.apache.catalina.Response response, java.nio.CharBuffer charBuffer)Appends an access log entry line, with info obtained from the given
request and response objects, to the given CharBuffer.
|
protected java.lang.String | calculateTimeZoneOffset(long offset)
StringBuffer sb = new StringBuffer();
if ((offset<0)) {
sb.append("-");
offset = -offset;
} else {
sb.append("+");
}
long hourOffset = offset/(1000*60*60);
long minuteOffset = (offset/(1000*60)) % 60;
if (hourOffset<10)
sb.append("0");
sb.append(hourOffset);
if (minuteOffset<10)
sb.append("0");
sb.append(minuteOffset);
return sb.toString();
|
protected synchronized java.util.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 5 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.
// Only create a new Date once per second, max.
long systime = System.currentTimeMillis();
if ((systime - currentDate.getTime()) > 5000) {
currentDate = new Date(systime);
}
return currentDate;
|
protected java.lang.String | lookup(java.lang.String month)Return the month abbreviation for the specified month, which must
be a two-digit String.
int index;
try {
index = Integer.parseInt(month) - 1;
} catch (Throwable t) {
index = 0; // Can not happen, in theory
}
return (months[index]);
|
public boolean | needTimeTaken()Has the time-taken token been specified in the access log pattern?
return needTimeTaken;
|