sanic logs get printed out twice when I use custom logging

Created on 4 Sep 2019  路  4Comments  路  Source: sanic-org/sanic

Describe the bug
Run the example code found on https://sanic.readthedocs.io/en/latest/sanic/examples.html#logging-enhancements
Terminal will print out something like these:

[2019-09-04 12:04:06 +0800] [15202] [INFO] Goin' Fast @ http://0.0.0.0:8000
[2019-09-04 12:04:06,630] 15202-INFO app::_helper():l1349: Goin' Fast @ http://0.0.0.0:8000
[2019-09-04 12:04:06 +0800] [15202] [INFO] Starting worker [15202]
[2019-09-04 12:04:06,633] 15202-INFO server::serve():l769: Starting worker [15202]

Every single log is being outputed twice including access log... which is very annoying

Code snippet
https://sanic.readthedocs.io/en/latest/sanic/examples.html#logging-enhancements

Expected behavior
sanic logs should be outputed once only along with custom logging facility

Environment (please complete the following information):

  • OS: archlinux
  • Version latest
stale

Most helpful comment

@symbiont-wilfred-denton try passing configure_logging=False for Sanic constructor. It seemed to fix my problem.

All 4 comments

I am having the same issue even with the override logging example.

@symbiont-wilfred-denton try passing configure_logging=False for Sanic constructor. It seemed to fix my problem.

Thanks @klesh this solved my problem. I see that the parameter is referenced here in the docs but isn't explained at all.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings