Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyConnect Logging Duplicate Entries #45

Closed
dixonwhitmire opened this issue Feb 27, 2021 · 2 comments · Fixed by #47
Closed

pyConnect Logging Duplicate Entries #45

dixonwhitmire opened this issue Feb 27, 2021 · 2 comments · Fixed by #47
Assignees
Projects

Comments

@dixonwhitmire
Copy link
Member

dixonwhitmire commented Feb 27, 2021

The current pyConnect logging configuration creates duplicate log entries.

2021-02-27 06:38:51,356 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET / HTTP/1.1" 404
2021-02-27 06:38:51,358 - uvicorn.access - INFO - 127.0.0.1:65251 - "GET /favicon.ico HTTP/1.1" 404
2021-02-27 06:38:56,290 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET / HTTP/1.1" 404
2021-02-27 06:38:56,291 - uvicorn.access - INFO - 127.0.0.1:65251 - "GET /favicon.ico HTTP/1.1" 404
2021-02-27 06:38:56,554 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET /docs HTTP/1.1" 200
2021-02-27 06:38:56,709 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET /openapi.json HTTP/1.1" 200
2021-02-27 06:38:56,849 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET /docs HTTP/1.1" 200
2021-02-27 06:38:56,892 - uvicorn.access - INFO - 127.0.0.1:65252 - "GET /openapi.json HTTP/1.1" 200
2021-02-27 06:39:02,029 - pyconnect.routes.status - INFO - Application: pyconnect.main:app
2021-02-27 06:39:02,029 - pyconnect.routes.status - INFO - Application: pyconnect.main:app
2021-02-27 06:39:02,029 - pyconnect.routes.status - INFO - Version: 0.25.0
2021-02-27 06:39:02,029 - pyconnect.routes.status - INFO - Version: 0.25.0
2021-02-27 06:39:02,031 - uvicorn.access - INFO - 127.0.0.1:65256 - "GET /status HTTP/1.1" 200

This appears to be due to Uvicorn log configuration.

It looks like we need to make some updates to the uvicorn logging configuration, specified with log_config to uvicorn.run(), and update our logging.yaml.

@dixonwhitmire dixonwhitmire self-assigned this Feb 27, 2021
@dixonwhitmire dixonwhitmire added this to Backlog in pyConnect via automation Feb 27, 2021
@dixonwhitmire dixonwhitmire moved this from Backlog to In progress in pyConnect Feb 27, 2021
@dixonwhitmire
Copy link
Member Author

The uvicorn logging configuration defines a handler for each logger. This causes duplicate entries, since logging is hierarchical. We can address the issue by:

  • Passing None to uvicorn.run(log_config)
  • Update our logging.yaml to define a handler for the root logger and child loggers as appropriate.

@dixonwhitmire
Copy link
Member Author

New output log

/Users/tdw/projects/lfh/pyconnect/venv/bin/python /Users/tdw/projects/lfh/pyConnect/pyconnect/main.py
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - Loaded logging configuration from logging.yaml
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - **************************************************
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - pyConnect Configuration Settings
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - ==================================================
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - UVICORN_APP: pyconnect.main:app
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - UVICORN_HOST: 0.0.0.0
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - UVICORN_PORT: 5000
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - UVICORN_RELOAD: True
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - ==================================================
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - CERTIFICATE_AUTHORITY_PATH: /Users/tdw/projects/lfh/pyconnect/venv/lib/python3.8/site-packages/certifi/cacert.pem
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - LOGGING_CONFIG_PATH: logging.yaml
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - ==================================================
2021-02-27 09:50:51,933 - pyconnect.server_handlers - INFO - **************************************************
2021-02-27 09:50:51,991 - uvicorn.error - INFO - Application startup complete.

@dixonwhitmire dixonwhitmire moved this from In progress to Review in progress in pyConnect Feb 27, 2021
pyConnect automation moved this from Review in progress to Done Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant