Open singhish opened 1 year ago
Hi @singhish, thanks for the reproducible example.
I guess you need to do the following after calling basicConfig()
:
logging.getLogger("sqlalchemy").setLevel("DEBUG")
db_url = "sqlite:///./test.db"
engine = create_engine(db_url, echo=False)
More details are available in the SQLAlchemy documentation: Configuring logging.
Hey @Delgan! Neat tool here that I am trying to implement in one of my projects.
I am trying to integrate SQLAlchemy's logging with Loguru using your
InterceptHandler
class exactly as it is written in the docs, but am still getting duplicate logs from SQLAlchemy. Here is a minimal example that shows what I'm talking about:This is the output I desire:
But, this is the output I'm getting. Note the duplicate lines coming from SQLAlchemy's own internal logger:
Package versions:
Any ideas as far as how to have SQLAlchemy's output get redirected to loguru without all the duplicate lines? Surely I'm not the first person to have run into this issue.
Thanks, and once again, lots of love for Loguru!