On Sun, Oct 1, 2017 at 7:41 PM,  <jens.troe...@gmail.com> wrote:
> I've used in my generated migration script:
>
> log = logging.getLogger(__name__)
> log.setLevel(logging.INFO)
>
> for now and that seems to work; quick glance at Alembic’s code indicates
> that’s what Alembic uses as well. The util/messaging.py is used in other
> contexts.

inside your environment's env.py, Alembic places this:

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

that's reading the [loggers] and other logging sections from your
alembic.ini file.   You can add your own logger name to that file so
that your own logger is usable and also configurable without changing
any source code, such as where you added log.setLevel(logging.INFO).

You can use any logger by name, like alembic's is
logging.getLogger("alembic"), and as you noted you can get one with
your own namespace using logging.getLogger(__name__).




>
> Jens
>
>
>
> On Sunday, October 1, 2017 at 5:03:31 PM UTC+10, jens.t...@gmail.com wrote:
>>
>> Hi,
>>
>> I’d like to output some logging info from my migration script, which was
>> generated by Alembic. Other than Python’s own logging module, what is the
>> recommended way to hook into Alembic’s logger to use it’s formatting?
>>
>> Thanks!
>> Jens
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy-alembic+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to