FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Process logging by mdesharnais · Pull Request #295 · polyml/polyml · GitHub

/ polyml Public

Process logging - #295

Open
mdesharnais wants to merge 2 commits into
polyml:masterfrom
mdesharnais:process-logging
Open

Process logging#295
mdesharnais wants to merge 2 commits into
polyml:masterfrom
mdesharnais:process-logging

Conversation

Copy link
Copy Markdown
Contributor

Hi @dcjm,
for debugging purposes, I would like to run Poly/ML with debug output to a file when building multiple Isabelle sessions. For each session, a new Poly/ML process is gets started. As of now, the file specified by --logfile gets opened in write mode, which means that the content of the file gets overridden every time.

To get the output for all sessions, I propose to add a new option --logappend to specify that the log file should be opened in append mode. The command-line interface is backward compatible: Without the option, the current behaviour of overriding the file is kept.

I also propose to add a new debug option --debug polyproc to output some information about the Poly/ML process at startup; the aim is to help identify which output corresponds to which Poly/ML process (e.g., in my case, this identifies the corresponding Isabelle session). The output looks like that:

$ printf "val x = 0;" | ./poly -q --debug polyproc
POLYPROC: Poly/ML 5.9.2 (eb3d10f3) pid 2348013 started at 2026-07-27T17:25:54Z: /home/martin/repos/polyml-martin/.libs/poly -q --debug polyproc

The --debug polyproc option logs a single line at start-up identifying
the process: the UTC start time, the process id, the Poly/ML release and
git versions, and the full command line.

Add TCHARFMT to diagnostics.h for printing a TCHAR string, following the
POLYUFMT convention in globals.h.
The --logfile option truncates the log file at start-up, so only the
last run survives.  The new --logappend option keeps earlier runs,
letting several accumulate in one file.

The command-line interface is backward compatible: Without --logappend,
the log file is truncated as before.

tjark commented Jul 27, 2026

Copy link
Copy Markdown

I'm probably missing something, but wouldn't it be better to manage log files from multiple runs outside of Poly/ML?

--logappend strikes me as a bit of a footgun: it makes logs less trustworthy by allowing unrelated runs to be mixed together, which can make debugging and reproducing issues harder. It also adds API surface for what seems like a relatively niche use case.

Wouldn't it be preferable to leave log rotation, archiving, or combining logs to external tooling, where users can choose the workflow that best fits their needs?

Copy link
Copy Markdown
Contributor Author

Hi @tjark, thanks for the feedback. There is precedent for supporting this kind of logging directly:

  • Isabelle can append to an existing log file with the -L option.
  • PostgreSQL can append to an existing log file when logging_collector is enabled and log_truncate_on_rotation is disabled; it also provides configurable log rotation.
  • Apache HTTP Server's CustomLog directive appends to the specified log file, with rotation commonly handled by a piped logging program.
  • The JVM's -Xlog option supports automatic log rotation. It also supports %p and %t in filenames, which expand to the JVM's PID and startup timestamp, respectively.

I considered using %p/%t substitutions, but chose --logappend because it is a small change that lets several (sequential) runs share one log file without overwriting earlier results. Because it is opt-in, the existing default behaviour remains unchanged. Users who need to limit the size of an accumulated log can combine it with an external log-rotation tool.

The %p/%t approach would serve a somewhat different use case: it would keep the output of each run separate and avoid filename collisions between concurrent Poly/ML processes. I am open to implementing that approach instead—or potentially in addition—if it would be preferable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL