Skip to content Skip to sidebar Skip to footer

Aiohttp How To Log Access Log?

I am trying to get a basic logger for aiohttp working, but there are simply no log messages being logged. Note_ logging custom messages works as expected. async def main_page(reque

Solution 1:

LOG_FORMAT should be "%s" if any. '%a %l %u %t "%r" %s %b "%{Referrer}i" "%{User-Agent}i"' is a valid parameter for .make_handler(access_log_format=...) call, not logging.Formatter.

As first step I suggest setting up root logger and after that going down to error/access logs. Perhaps access log worth own private file like access.log. To achieving this you need to setup a handler for aiohttp.access logger, not for top-level aiohttp.

Solution 2:

Simply import logging and add

logging.basicConfig(level=logging.DEBUG)

somewhere before your run_app call.

Post a Comment for "Aiohttp How To Log Access Log?"