-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
The libraries calls loggin.debug() here:
fastapi-proxy-lib/src/fastapi_proxy_lib/core/http.py
Lines 276 to 281 in a45086a
| logging.debug( | |
| "HTTP: client:%s ; url:%s ; head:%s", | |
| request.client, | |
| proxy_request.url, | |
| proxy_request.headers, | |
| ) |
As a side effect, this function calls logging.basicConfig() if no handler is set on the root handler:
This result in applications logging entries twice, if they don't use the root handler:
auth-api-c49b5985b-g8z7t api INFO: test
auth-api-c49b5985b-g8z7t api INFO:authserver.routers.user_group_v2:test
as a workaround I am registering a null handler on the root logger:
logging.getLogger().addHandler(logging.NullHandler())
It's a bad practice for the library to call basicConfig(). Instead of the stupid top-level logging functions you should use your own logger, e.g.
# in core/http.py
import logging
logger = logging.getLogger("fastapi-proxy-lib")
...
logger.debug(
"HTTP: client:%s ; url:%s ; head:%s",
...)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers