Skip to content

Append to the server log on restart instead of overwriting it - #317

Open
hannahbast wants to merge 1 commit into
mainfrom
append-server-log
Open

Append to the server log on restart instead of overwriting it#317
hannahbast wants to merge 1 commit into
mainfrom
append-server-log

Conversation

@hannahbast

Copy link
Copy Markdown
Collaborator

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.

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.
Copilot AI lite review requested due to automatic review settings August 10, 2026 21:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_file to 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 thread src/qlever/util.py
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants