Engine logger names are unpredictable
An engine logger's name is based on the engine's instance ID. This makes it impossible to preconfigure certain engines in a Python log-configure file because the engine has not been created. An example would be to silence an oververbose engine while logging most engines.
If create_engine took a 'name' argument, that name could be used in the logger name, which would make it predictable. Example:
engine = create_engine("mysql://...", name="stats")
[logger_stats](logger_stats)
level = WARN
handlers =
qualname = sqlalchemy.engine.base.Engine.stats
[logger_sqlalchemy](logger_sqlalchemy)
level = INFO
handlers =
qualname = sqlalchemy.engine
Comments (8)
-
repo owner -
repo owner - changed milestone to 0.6.xx
-
Account Deleted What about the attached patch?
-
repo owner great, that's the idea
-
Account Deleted Some fixes added.
The patch now does not break existing code (the old patch was broken, I have overridden it).
This still needs a patch to update the documentation and a test suite. As for the test suite, unfortunately I have no idea how this feature should be tested.
-
Account Deleted Perhaps the
ident
attribute in theEngine
andPool
should default to :hex(id(self))
or, to follow current code,
'0x...%s' % hex(id(self))[-4:](-4:)
instead of
None
?Should we use a function, instead of an attribute?
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
optional, sure. Feel free to provide a patch for this.