Alembic: Logging issue after configuration change (EBv2)

286 views
Skip to first unread message

cmana...@gmail.com

unread,
Oct 21, 2021, 12:08:37 PM10/21/21
to sqlalchemy
Hi,

Like the title says, I'm seeing some weird logging issues in production.  Using alembic and flask-migrate latest.  Works great locally (no issues) and worked great on the server prior to a platform change.

I think I'm dealing with either a log level issue or I'm just logging into a black hole.  I see stdout in the logs from prints and echos.  I can see when exceptions are raised.  I can see prints inside the migration.  When I run "from flask_migrate import current; current()" I see the revision ID as output.  I just don't see the log output from an upgrade.  E.g. "A -> B".  Even though I know the migrations are running.

I've been looking at the alembic.ini.  I see logger_alembic has a blank handler.  Is there a way to get it to point to stdout? Something like handlers = stdout.  I'm not sure where its output is going currently.

I recently upgraded to the newest elastic beanstalk version.  With it came some hook changes.  I mention them here just in case others have had this issue.  Basically an ebextension became a postdeploy platform hook.

This is what my bash script looks like.

    "sudo docker exec $(sudo docker ps -q) flask managedb"

This is what the managedb flask command looks like.

    "from flask_migrate import upgrade; upgrade()"

Hopefully this isn't too out of scope for this group.  Any help is greatly appreciated.

Mike Bayer

unread,
Oct 21, 2021, 12:30:24 PM10/21/21
to noreply-spamdigest via sqlalchemy


On Thu, Oct 21, 2021, at 12:08 PM, cmana...@gmail.com wrote:
Hi,

Like the title says, I'm seeing some weird logging issues in production.  Using alembic and flask-migrate latest.  Works great locally (no issues) and worked great on the server prior to a platform change.

I think I'm dealing with either a log level issue or I'm just logging into a black hole.  I see stdout in the logs from prints and echos.  I can see when exceptions are raised.  I can see prints inside the migration.  When I run "from flask_migrate import current; current()" I see the revision ID as output.  I just don't see the log output from an upgrade.  E.g. "A -> B".  Even though I know the migrations are running.

I've been looking at the alembic.ini.  I see logger_alembic has a blank handler.  Is there a way to get it to point to stdout? Something like handlers = stdout.  I'm not sure where its output is going currently.

the logging is set up in your own env.py.  this is the default:


that's directly where alembic calls the Python logging API.  so you can change that, or pdb in there and see if the logger works, etc.      so overall you likely have something up with the way in which the program is being run as relates to stdout etc.    try using a "File" logger to a specific log file and see if it writes messages, things like that.



I recently upgraded to the newest elastic beanstalk version.  With it came some hook changes.  I mention them here just in case others have had this issue.  Basically an ebextension became a postdeploy platform hook.

This is what my bash script looks like.

    "sudo docker exec $(sudo docker ps -q) flask managedb"

This is what the managedb flask command looks like.

    "from flask_migrate import upgrade; upgrade()"

Hopefully this isn't too out of scope for this group.  Any help is greatly appreciated.


--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages