Append to the server log on restart instead of overwriting it - #317
Open
hannahbast wants to merge 1 commit into
Open
Append to the server log on restart instead of overwriting it#317hannahbast wants to merge 1 commit into
hannahbast wants to merge 1 commit into
Conversation
So far, `qlever start` deleted the existing server log and started the server with a truncating redirect. In particular, when the server had crashed, its last log messages (which often identify the cause of the crash) were lost on the next start. Now the server log is opened in append mode and survives restarts. The tail that follows the log until the server is ready starts at the size the file had before the start, so it still only shows the output of the new server process.
There was a problem hiding this comment.
Pull request overview
This PR changes qlever start to preserve server logs across restarts by appending to the existing log file rather than truncating it, while still tailing only the newly produced output during startup.
Changes:
- Switch server log redirection from overwrite (
>) to append (>>) on startup. - Extend
tail_log_fileto support starting tailing from a specified byte offset. - Track the pre-start log size and tail from that offset so only the new run’s output is shown.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/qlever/commands/start.py | Append to the server log on start and compute a byte offset to tail only the new run’s output. |
| src/qlever/util.py | Add start_offset support to tail_log_file and tail from that byte position. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for view_name in preload_materialized_views | ||
| ) | ||
| start_cmd += f" > {args.name}.server-log.txt 2>&1" | ||
| start_cmd += f" >> {args.name}.server-log.txt 2>&1" |
Comment on lines
+630
to
631
| tail_cmd = f"exec tail -c +{start_offset + 1} -f {log_file}" | ||
| return subprocess.Popen(tail_cmd, shell=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So far,
qlever startdeleted the existing server log and started the server with a truncating redirect. In particular, when the server had crashed, its last log messages, which often identify the cause of the crash, were lost on the next start.Now the server log is opened in append mode and survives restarts. The tail that follows the log until the server is ready starts at the size the file had before the start, so it still only shows the output of the new server process.