Add "View service log" (diagnostic activity log), distinct from update log

Tester couldn't see anything under "View service update log" -- that item only
shows the SELF-UPDATE log (written when the service updates itself to a new
version), so with no update it's empty. What he actually wanted is the service's
ACTIVITY log, which records why the service is or isn't sending
("streaming N sources to M peers", "profile has no WASAPI send sources",
"no reachable peers"), but there was no way to open it.

- New Service menu item "View service log" opens the newest diagnostic log in
  ProgramData\RemSound\service\logs. If none exists it explains that service
  logging must be enabled first (Configure service profile -> Logging), so the
  path to getting a log is discoverable.
- ServiceStore.LogsDirectory + NewestLogFile() to locate it (same absolute path
  for the SYSTEM service and the interactive user).
- Clarified the update-log "nothing yet" message to point at the new item.

This also unblocks diagnosing the pre-login send issue: enable service logging,
reproduce, then View service log to see the exact reason.

New self-test "Service log discovery": folder resolves under the service dir,
newest .log is chosen, empty case handled. Gate 32/32.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-14 19:18:18 +01:00
co-authored by Claude Opus 4.8
parent e3e57affb4
commit 91f5fc74c0
3 changed files with 79 additions and 2 deletions
+24 -2
View File
@@ -2219,6 +2219,8 @@ 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 activityLog = new ToolStripMenuItem("&View service log") { AccessibleName = "View service log" };
activityLog.Click += (_, _) => OpenServiceLog();
var updateLog = new ToolStripMenuItem("View service update &log") { AccessibleName = "View service update log" };
updateLog.Click += (_, _) => OpenServiceUpdateLog();
@@ -2227,7 +2229,7 @@ public sealed class MainForm : Form
status, new ToolStripSeparator(),
configure, new ToolStripSeparator(),
install, uninstall, start, stop, new ToolStripSeparator(),
updateLog,
activityLog, updateLog,
});
serviceMenu.DropDownOpening += (_, _) =>
{
@@ -2258,12 +2260,32 @@ public sealed class MainForm : Form
return serviceMenu;
}
/// <summary>Opens the service's DIAGNOSTIC log — the "what is the service doing / why isn't it sending"
/// activity log, which records the streaming decision on every resume (e.g. "streaming N sources to M
/// peers", or "profile has no WASAPI send sources"). Distinct from the update log (self-updates only).
/// The log is written only while service logging is enabled (Configure service profile → Logging), so if
/// there's nothing here yet, that's the first thing to turn on.</summary>
private void OpenServiceLog()
{
var path = ServiceStore.NewestLogFile();
if (path is null)
{
var msg = ServiceStore.LoadLoggingEnabled()
? "No service log yet. The service writes one once it starts with logging on — start (or restart) the service, then check back here."
: "No service log yet. Turn on logging first: Service menu → Configure service profile → Logging tab → enable service logging, then start (or restart) the service. The log records what the service does and why it is or isn't sending.";
MessageBox.Show(this, msg, 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 service log ({path}): {ex.Message}", AppName, MessageBoxButtons.OK, MessageBoxIcon.Warning); }
}
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);
MessageBox.Show(this, "No service update log yet — it's written the first time the service updates itself. (For what the service is doing day to day, use \"View service log\" instead.)", AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
try { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(path) { UseShellExecute = true }); }