Migrations no longer clobber app logging: drop fileConfig(alembic.ini) from migrations/env.py. fileConfig rewrote the root logger (WARN + disable_existing) during the engine's startup migration, silently muting every INFO line afterwards — engine.log froze at the migration's last line and uvicorn access logs vanished, swallowing the TRACE instrumentation. The app owns logging (main.py basicConfig); alembic.ini's [loggers] applied only to standalone CLI runs. Verified: fresh engine boot now logs access lines live (GET /jobs flowing), 83 tests pass.
This commit is contained in:
parent
768b75915a
commit
6ec811393a
1 changed files with 8 additions and 3 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from logging.config import fileConfig
|
|
||||||
|
|
||||||
from alembic import context
|
from alembic import context
|
||||||
from sqlalchemy import pool
|
from sqlalchemy import pool
|
||||||
|
|
@ -14,9 +13,15 @@ from shonar.core.config import get_settings
|
||||||
from shonar.db import models # noqa: F401 (register tables)
|
from shonar.db import models # noqa: F401 (register tables)
|
||||||
from shonar.db.base import Base
|
from shonar.db.base import Base
|
||||||
|
|
||||||
|
# NOTE: deliberately NO fileConfig(alembic.ini) here. fileConfig rewrites
|
||||||
|
# the ROOT logger (alembic.ini sets it to WARN and disables existing
|
||||||
|
# loggers), so calling it during the app's startup migration silently
|
||||||
|
# muted every INFO line the engine and uvicorn emitted afterwards. The
|
||||||
|
# app owns its logging config (shonar.main basicConfig); alembic.ini's
|
||||||
|
# [loggers] sections only ever applied to standalone CLI runs, which work
|
||||||
|
# fine with Python's default logging.
|
||||||
|
|
||||||
config = context.config
|
config = context.config
|
||||||
if config.config_file_name is not None:
|
|
||||||
fileConfig(config.config_file_name)
|
|
||||||
|
|
||||||
settings = get_settings()
|
settings = get_settings()
|
||||||
config.set_main_option("sqlalchemy.url", settings.database_url)
|
config.set_main_option("sqlalchemy.url", settings.database_url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue