BE: Removal of stdout.log - #1672
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Changesstdout.log removal and app.log migration
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/API_LOGS.md (1)
19-26:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMissing
app_front.logfrom the documented allowed files list.The API_LOGS.md "Allowed Files" section lists 6 files, but the backend implementation in
server/api_server/logs_endpoint.pyexplicitly allows 7 files. The list is missingapp_front.log, which users can legitimately purge via the DELETE endpoint.Add app_front.log to the allowed files list
**Allowed Files:**app.log
+app_front.log
IP_changes.log
stderr.log
app.php_errors.log
execution_queue.log
db_is_locked.log🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/API_LOGS.md` around lines 19 - 26, The "Allowed Files" section in docs/API_LOGS.md is missing app_front.log, which is actually allowed by the backend implementation in server/api_server/logs_endpoint.py. Add app_front.log to the documented list in the correct alphabetical position between app.log and IP_changes.log to ensure the documentation matches the backend implementation and users know they can legitimately purge this file.
🧹 Nitpick comments (1)
server/api_server/logs_endpoint.py (1)
28-31: ⚡ Quick winAvoid duplicated log allowlists across schema and runtime.
Line [28] duplicates
ALLOWED_LOG_FILESfromserver/api_server/openapi/schemas.py. This can drift and desync documented validation from runtime behavior.♻️ Suggested consolidation
import os import sys +from typing import get_args from flask import jsonify @@ from const import logPath # noqa: E402 [flake8 lint suppression] from logger import mylog, Logger # noqa: E402 [flake8 lint suppression] from helper import get_setting_value # noqa: E402 [flake8 lint suppression] from messaging.in_app import write_notification # noqa: E402 [flake8 lint suppression] +from api_server.openapi.schemas import ALLOWED_LOG_FILES # noqa: E402 [flake8 lint suppression] @@ - allowed_files = [ - 'app.log', 'app_front.log', 'IP_changes.log', 'stderr.log', - 'app.php_errors.log', 'execution_queue.log', 'db_is_locked.log' - ] + allowed_files = list(get_args(ALLOWED_LOG_FILES))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/api_server/logs_endpoint.py` around lines 28 - 31, The allowed_files list in logs_endpoint.py duplicates the ALLOWED_LOG_FILES constant that already exists in server/api_server/openapi/schemas.py, creating a maintenance risk where the two lists could drift out of sync. Import the ALLOWED_LOG_FILES constant from the schemas module and replace the hardcoded allowed_files list with a reference to this imported constant to maintain a single source of truth for the allowed log file names.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@front/plugins/maintenance/maintenance.py`:
- Around line 43-74: The if block that handles files exceeding MAX_TAIL_SIZE
(starting around line 59) is truncating the file to empty with f.truncate(0),
which discards all log content instead of preserving the recent entries. Replace
this truncate-to-empty approach with the same logic used in the else branch:
call tail_file(logFile, MAINT_LOG_LENGTH) to extract the last MAINT_LOG_LENGTH
lines, then open the file, seek to the beginning, truncate, and write those
lines back. This ensures that even large logs keep their configured tail instead
of being completely wiped.
---
Outside diff comments:
In `@docs/API_LOGS.md`:
- Around line 19-26: The "Allowed Files" section in docs/API_LOGS.md is missing
app_front.log, which is actually allowed by the backend implementation in
server/api_server/logs_endpoint.py. Add app_front.log to the documented list in
the correct alphabetical position between app.log and IP_changes.log to ensure
the documentation matches the backend implementation and users know they can
legitimately purge this file.
---
Nitpick comments:
In `@server/api_server/logs_endpoint.py`:
- Around line 28-31: The allowed_files list in logs_endpoint.py duplicates the
ALLOWED_LOG_FILES constant that already exists in
server/api_server/openapi/schemas.py, creating a maintenance risk where the two
lists could drift out of sync. Import the ALLOWED_LOG_FILES constant from the
schemas module and replace the hardcoded allowed_files list with a reference to
this imported constant to maintain a single source of truth for the allowed log
file names.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f9d2135c-4ed5-4dd6-bf56-c403a60a2fbf
📒 Files selected for processing (22)
.devcontainer/DockerfileDockerfileDockerfile.debiandocs/API_LOGS.mddocs/API_OLD.mddocs/DOCKER_COMPOSE.mddocs/PLUGINS_DEV.mddocs/PLUGINS_DEV_DATASOURCES.mddocs/PLUGINS_DEV_DATA_CONTRACT.mddocs/PLUGINS_DEV_QUICK_START.mddocs/PLUGINS_DEV_SETTINGS.mdfront/php/components/logs_defaults.jsonfront/plugins/maintenance/maintenance.pyinstall/debian12/start.debian12.shinstall/production-filesystem/services/start-backend.shinstall/proxmox/proxmox-install-netalertx.shinstall/ubuntu24/install.shserver/api_server/logs_endpoint.pyserver/api_server/mcp_endpoint.pyserver/api_server/openapi/schemas.pyserver/helper.pyserver/logger.py
💤 Files with no reviewable changes (6)
- Dockerfile.debian
- .devcontainer/Dockerfile
- front/php/components/logs_defaults.json
- docs/API_OLD.md
- server/logger.py
- Dockerfile
Summary by CodeRabbit
Documentation
app.log(instead ofstdout.log) for backend and plugin log inspection.stdout.logfrom the purgeable list.Chores
stdout.log, usingapp.logand other dedicated log files instead.app.log/error logs only.Bug Fixes
stdout.log.