-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix: add environment variable flag to log alembic to stdout #10620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 error, 2 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.env.example (1)
25-26: Consider clarifying the comment wording.The comment refers to this as "Alembic logs path flag" which is slightly unclear. Consider rephrasing to better reflect that this controls the log output destination rather than a path setting.
Suggested wording:
-# Alembic logs path flag. If set to true, Alembic will log to stdout. +# Alembic log output destination. If set to True, Alembic will log to stdout instead of a file.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.env.example(1 hunks)src/backend/base/langflow/services/database/service.py(3 hunks)src/lfx/src/lfx/services/settings/base.py(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase uses structlog for structured logging with a centralized configuration in `src/backend/base/langflow/logging/logger.py`. The configuration supports multiple output formats (JSON, CSV, console) based on environment settings and properly implements global log level filtering.
Applied to files:
src/lfx/src/lfx/services/settings/base.py
🧬 Code graph analysis (1)
src/backend/base/langflow/services/database/service.py (1)
src/backend/tests/unit/api/v2/test_mcp_servers_file.py (1)
settings_service(96-97)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Test Docker Images / Test docker images
- GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
- GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
- GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
- GitHub Check: Test Starter Templates
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Update Component Index
🔇 Additional comments (4)
src/lfx/src/lfx/services/settings/base.py (1)
248-249: LGTM!The new setting is correctly defined with appropriate type annotation, default value, and clear documentation. The placement next to the related
alembic_log_filesetting makes sense for maintainability.src/backend/base/langflow/services/database/service.py (3)
6-8: LGTM!The new imports are appropriate for the implementation. Using
nullcontextis the correct approach for wrappingsys.stdoutin a context manager without closing it.
77-82: LGTM!The early return when logging to stdout is an efficient approach that avoids unnecessary file system operations. The logic correctly handles both stdout and file-based logging scenarios.
337-341: LGTM!The buffer context implementation correctly handles both stdout and file-based logging:
- Uses
nullcontext(sys.stdout)for stdout logging, which properly wraps stdout without closing it- Uses file open with "w" mode for file logging, which will be properly closed by the context manager
The file is opened in "w" (truncate) mode, which overwrites the log on each run. This appears intentional to prevent the log file growth issue mentioned in the PR objectives.
zzzming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update document? Can you also make sure we don't need to /data folder access from alembic point of view?
2162032 to
8f67c04
Compare
b66ce17 to
0b15739
Compare
06eb3ca to
71fccc2
Compare
Introduce a Boolean environment variable flag that will have Alembic to log to stdout if set to True. Default value is False to preserve Langflow's original behavior (logging to alembic.log file).
Fixes the issue in production where alembic logs were not written to stdout in k8s.
Summary by CodeRabbit
New Features
LANGFLOW_ALEMBIC_LOG_TO_STDOUTenvironment variable to output logs to standard output instead of file-based logging, with file-based logging as the default.