Replies: 1 comment 1 reply
-
that env.py is yours to modify freely. take out the fileconfig and do whatever you want to set up logging. alembic does nothing with loggers or handlers whatsoever except write messages to loggers, it has nothing to do with existing loggers or anything else like that, it's 100% that one line of code that is part of your own application to change in any way you'd like. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had the need to trigger alembic commands in one of my flask endpoints. One of the goals was to include the output from alembic in the returned json. For commands such as
upgrade()
, the entirety of what is output is done via logging. Seemed straight forward to add a handler to a standard python logger and store the logs. What I attempted was roughly:The issue I discovered is configuring the python logger used by alembic proved impossible as "existing loggers are disabled" when the config file is read by
logging.config.fileConfig
. There is an optional argumentdisable_existing_loggers
which would allow the above code snippet to work, but alembic doesn't pass it or provide any way to do so. I've given up on getting alembic's output and instead am generating my own, but wanted to report this limitation.https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig
Beta Was this translation helpful? Give feedback.
All reactions