go-aah / aah

A secure, flexible, rapid Go web framework
https://aahframework.org
MIT License
690 stars 33 forks source link

Access Log: static files get logged always (or twice) #219

Closed AugustHell closed 5 years ago

AugustHell commented 5 years ago

What version of aah are you using (aah --version)?

v0.11.4

Does this issue reproduce with the latest release?

not tested

What operating system are you using (such as macOS, Linux and Windows)?

Linux

What did you do?

added configuration:

server {
    access_log {
      enable = true
      file = "logs/access.log"
      pattern = "%clientip %custom:- %reqtime %reqmethod %requrl %reqproto %resstatus %ressize %restime %reqhdr:referer"
      static_file = false
    }
}

What did you expect to see?

No static files in the access logs

What did you see instead?

Log entries for static .css, .jpg .js .gif files.

Using static_file = true logs every of these files twice, like:

xxx.xxx.xxx.xxx - 2018-10-30T17:01:44Z GET /favicon.ico HTTP/2.0 304 0 0.2215 - 
xxx.xxx.xxx.xxx - 2018-10-30T17:01:44Z GET /favicon.ico HTTP/2.0 304 0 0.2310 - 
while a generated, non static html request in both cases (static_file = true or false) gets logged once:
xxx.xxx.xxx.xxx - 2018-10-30T17:01:44Z GET / HTTP/2.0 200 4515 1.9657 -

Don't think it is a big issue, but want to report it.

jeevatkm commented 5 years ago

@AugustHell Thanks for reporting it. I will look into it.

jeevatkm commented 5 years ago

@AugustHell I have found the root for the issue. Access log called twice in the request life cycle and one of the call location does not have check for server.access_log.static_file.

I will apply fix in upcoming release v0.12.0. Thanks.

jeevatkm commented 5 years ago

Done 😄

AugustHell commented 5 years ago

Great. Thank you :+1