The problem you're having is that you're configuring the sqlalchemy.engine
Logger
twice. The logger sections correspond to instances of logging.Logger
, things that are returned by logging.getLogger(qualname)
. Only one object can be returned by that call, you can't possibly set up more than one of them with the same qualname.
What you need is multiple handlers for that logger, in the same way that you gave your root logger multiple handlers. You can then specify the desired log level on the individual handlers.
Unfortunately, fileConfig()
doesn't give you an easy way to configure the same handler with different log levels depending on the logger that originated the record, you'll need to set up duplicate handler sections for both root and the sqlalchemy.engine
loggers in order to have different log levels for them.