Service: always-on update log + "View service update log" menu item

Local checkpoint - NOT for public release. Ed wants logging for the service updating.

- New ALWAYS-ON update log at ProgramData\RemSound\service\update.log (not gated on the
  service-logging toggle - updates are rare but important). It records the full sequence:
    * "update detected: newer RemSound.exe (5.3) found, running 5.2 - restarting"
    * the restarter's own "stopping" / "service started" (or "START FAILED - <reason>")
    * "update complete: now running version 5.3"
  The restart PowerShell writes its stop/start outcome itself, so the part that runs AFTER
  the old service process is gone - and any failed start - is still captured. A pending
  marker set at detection and consumed on the next start closes the loop (its absence flags
  a stuck update).
- Service menu gains "View service update log" to open it (friendly message if none yet).

Update log + pending-marker round-trip covered by the isolation self-test. Gate 27/27.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-13 09:59:40 +01:00
co-authored by Claude Opus 4.8
parent d5767050f2
commit 4b2ecca960
5 changed files with 87 additions and 11 deletions
+16 -1
View File
@@ -2194,12 +2194,15 @@ public sealed class MainForm : Form
start.Click += (_, _) => ServiceAction(ServiceControl.StartVerb, "start", confirm: false);
var stop = new ToolStripMenuItem("Sto&p service") { AccessibleName = "Stop service" };
stop.Click += (_, _) => ServiceAction(ServiceControl.StopVerb, "stop", confirm: false);
var updateLog = new ToolStripMenuItem("View service update &log") { AccessibleName = "View service update log" };
updateLog.Click += (_, _) => OpenServiceUpdateLog();
serviceMenu.DropDownItems.AddRange(new ToolStripItem[]
{
status, new ToolStripSeparator(),
configure, new ToolStripSeparator(),
install, uninstall, start, stop,
install, uninstall, start, stop, new ToolStripSeparator(),
updateLog,
});
serviceMenu.DropDownOpening += (_, _) =>
{
@@ -2220,6 +2223,18 @@ public sealed class MainForm : Form
return serviceMenu;
}
private void OpenServiceUpdateLog()
{
var path = ServiceStore.UpdateLogPath;
if (!File.Exists(path))
{
MessageBox.Show(this, "No service update log yet — it's written the first time the service updates itself.", AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
try { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(path) { UseShellExecute = true }); }
catch (Exception ex) { MessageBox.Show(this, $"Could not open the update log ({path}): {ex.Message}", AppName, MessageBoxButtons.OK, MessageBoxIcon.Warning); }
}
private static string DescribeAgo(DateTime utc)
{
var span = DateTime.UtcNow - utc;