Mobile app version of vmapp.org
Login or Join
Gloria169

: Is granular http logging for an application handled at the application level or the http server level? I need to log all requests coming into the server. Typical things you would get from Apache

@Gloria169

Posted in: #Http #Logging

I need to log all requests coming into the server. Typical things you would get from Apache log formatting or IIS.

I am using a WSGI standards based server, Apache mod_wsgi, gunicorn, Tornado. It doesn't matter.

Which is an efficient logging method for a production application? My application is in Flask, and I have Python logging set up. Works fine. But I am afraid it will slow my application to a crawl, and it is very difficult to get things like bytes send and received and the rest of granular type logging a server provides. It shouldn't matter the language or application. I think this is applicable to anything a web server can respond to.

Am I correct that I shouldn't fight with a Python framework and let the server do the work?

With something like IIS you have ODBC logging. You don't seem to have that anywhere else.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gloria169

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Your HTTP server should handle your access logging.

I add additional logging from my application because there are fields that I want log that the HTTP server doesn't have access too:


Response category (page, html fragment, image, js, css, json, etc)
Page template (name of template file used to generate the page)
Logged in user id (HTTP server can log basic authentication user, but most web apps use other types of logins)
Session id
Campaign info (how the user originally got to your site)


Logging does not usually put undue burden on your servers as long as your are logging only a few lines per request. Logging does need to be synchronized or have one log file per thread. A good logging framework will handle that for you.

Just like with access logs, you need to periodically rotate any logs that your application creates to keep disks from filling up.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme