Open NicolasLM opened 6 years ago
When used as a library, aiohttp-wsgi doesn't touch the logging config.
When used as a CLI application, it sets up basic logging configuration. Being able to specify verbosity via a CLI flag is pretty common, and most WSGI apps do not configure logging explicitly.
I guess it's a question of where logging config belongs. Django thinks it belongs at module import time, whereas aiohttp-wsgi believes it belongs after argument parsing at runtime.
On 2 February 2018 at 13:24, Nicolas Le Manchet notifications@github.com wrote:
aiohttp-wsgi shouldn't touch the logging configuration or at least provide an option to instruct it not to.
Here is a real life scenario where the setup done by aiohttp-wsgi is problematic: a Django user has a custom configuration for the aiohttp logger:
in Django settings.pyLOGGING = {
"loggers": { "aiohttp": { "level": "ERROR" } }
}
What happens is:
- the interpreter logging is configured first by Django (when the WSGI app is imported)
- aiohttp-wsgi logging.basicConfig does nothing because logging is already configured
- the aiohttp logger level gets overridden by the level ofaiohttp-wsgi
It may not sound too bad, but it's tiresome when a user has to track down all third-party libraries doing such things, thus I recommend libraries authors to avoid touching logging and let the user configure this the way he wants in a central place.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/aiohttp-wsgi/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCKX-IXVGnoCOA-8SX_j7JHQ-bgp7ks5tQwx5gaJpZM4R3LPk .
As the new aiohttp_wsgi.serve
does not configure logging, I believe this issue can be closed.
It might still be nice to have it as an option to the CLI, I think.
I just ran out of time to implement it today!
aiohttp-wsgi
shouldn't touch the logging configuration or at least provide an option to instruct it not to.Here is a real life scenario where the setup done by
aiohttp-wsgi
is problematic: a Django user has a custom configuration for theaiohttp
logger:What happens is:
aiohttp-wsgi
logging.basicConfig
does nothing because logging is already configuredaiohttp
logger level gets overridden by the level ofaiohttp-wsgi
It may not sound too bad, but it's tiresome when a user has to track down all third-party libraries doing such things, thus I recommend libraries authors to avoid touching
logging
and let the user configure this the way he wants in a central place.