Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Log server local time instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
cespare committed Oct 31, 2012
1 parent e3c4958 commit 794af13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apachelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Record struct {

// Write the Record out as a single log line to out.
func (r *Record) Log(out io.Writer) {
timeFormatted := r.time.Format("02/Jan/2006 03:04:05")
timeFormatted := r.time.Format("02/Jan/2006 15:04:05")
fmt.Fprintf(out, apacheFormatPattern, r.ip, timeFormatted, r.method, r.uri, r.protocol, r.status,
r.responseBytes, r.elapsedTime.Seconds())
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
h.handler.ServeHTTP(record, r)
finishTime := time.Now()

record.time = finishTime.UTC()
record.time = finishTime
record.elapsedTime = finishTime.Sub(startTime)

record.Log(h.out)
Expand Down

0 comments on commit 794af13

Please sign in to comment.