granian icon indicating copy to clipboard operation
granian copied to clipboard

static file request not reported in access log

Open a-musing-moose opened this issue 5 months ago • 2 comments
trafficstars

I am running a Django application (locally) with something like the following:

granian --host 0.0.0.0 --port 8000 --access-log --static-path-route /static --static-path-mount /tmp/static/ --interface asginl my.app.asgi:application

As you can see from the options - I am using Granian to server static files (successfully), and I have the access logging turned on. It seem that requests for static files are not included in the access log.

I noticed this as I initially misconfigured it and was trying to determine why file were not being server - but there was nothing in the access logs (or the regular logs either - even with the level set to debug).

a-musing-moose avatar May 27 '25 23:05 a-musing-moose

Correct, the current implementation doesn't write to access logs. The main thing is that the access log is handled by Python, whereas static files serving happens in Rust code only. I might find a way to call the access log from within the current code, but it might take a while to figure out the best way to do so.

gi0baro avatar May 28 '25 12:05 gi0baro

Taking a while is fine - this initially came up as I misconfigured things (a trailing / on one of the command line switch - I forget which). It took me a little longer to work that out as there was nothing logged access or otherwise.

But needless to say but not rush - Granian is already pretty impressive!

a-musing-moose avatar Jun 03 '25 23:06 a-musing-moose