mirror of
https://github.com/open-webui/terminals.git
synced 2026-12-05 11:07:56 -05:00
fix: logging updates to prevent silent errors
This commit is contained in:
1 parent
dbb870c9fa
commit
0cb5a73e61
4 files changed
+10
-5
No files matched your search
@@ -1,5 +1,7 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
@@ -46,4 +46,6 @@ def setup_logging() -> None:
|
||||
# Intercept stdlib logging (uvicorn, sqlalchemy, etc.).
|
||||
logging.basicConfig(handlers=[_InterceptHandler()], level=0, force=True)
|
||||
for name in ("uvicorn", "uvicorn.error", "uvicorn.access", "sqlalchemy"):
|
||||
logging.getLogger(name).handlers = [_InterceptHandler()]
|
||||
named = logging.getLogger(name)
|
||||
named.handlers = [_InterceptHandler()]
|
||||
named.propagate = False
|
||||
+4
-3
@@ -17,11 +17,12 @@ from terminals.routers.proxy import close_proxy_client, router as proxy_router
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Startup / shutdown lifecycle."""
|
||||
setup_logging()
|
||||
|
||||
# Run DB migrations
|
||||
# Run DB migrations first (alembic's fileConfig reconfigures logging).
|
||||
init_db()
|
||||
|
||||
# Set up loguru AFTER alembic so our InterceptHandler isn't overwritten.
|
||||
setup_logging()
|
||||
|
||||
app.state.backend = create_backend()
|
||||
|
||||
# Recover state from any running containers (survives process restart).
|
||||
|
||||
@@ -23,7 +23,7 @@ config = context.config
|
||||
|
||||
# Set up Python logging from the INI file.
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
fileConfig(config.config_file_name, disable_existing_loggers=False)
|
||||
|
||||
# Target metadata for autogenerate support.
|
||||
target_metadata = Base.metadata
|
||||
|
||||
Reference in new issue
Block a user