Skip to content

devproxy logs: say which instance is shown when multiple are running - #1935

Merged
waldekmastykarz merged 7 commits into
mainfrom
copilot/devproxy-logs-instance-selection-fix
Oct 21, 2026
Merged

waldekmastykarz merged 7 commits into
mainfrom
copilot/devproxy-logs-instance-selection-fix

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

If several Dev Proxy instances are running and --pid isn't given, devproxy logs picks one: the system-proxy instance if there is one, otherwise the most recently started. Until now it did this silently. This PR keeps the same choice but tells the user which instance it chose and how to pick another.

$ devproxy logs
Multiple Dev Proxy instances are running. Showing logs from PID 4888 (most recently started instance). Other instances: 4837. Use --pid to show logs from a specific instance.
 info    Dev Proxy (Kestrel engine) listening on 127.0.0.1:40753
 ...

Changes

  • StateManager.SelectPrimaryState: the instance-selection ordering now lives in its own function. LoadStateAsync and LogsCommand both use it.
  • LogsCommand: loads all running instances. When more than one is running, it prints the notice above to stderr, so piped or redirected log output is unchanged.
  • Tests: DevProxy.Tests/LogsCommandTests.cs covers the single-instance case (no notice), the system-proxy choice, and the most-recently-started fallback.

For reviewers

This PR takes the issue's "at least" option: it reports the choice and doesn't make logs behave like stop/status. Requiring --pid when several instances are running would match those commands. It would also break scripts that call devproxy logs with no options. That can be a follow-up if we want it.

Copilot AI and others added 2 commits October 20, 2026 10:50
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix devproxy logs to notify instance selection devproxy logs: say which instance is shown when multiple are running Oct 20, 2026
Copilot AI requested a review from waldekmastykarz October 20, 2026 10:52
@waldekmastykarz
waldekmastykarz marked this pull request as ready for review October 20, 2026 17:49
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 20, 2026 17:49
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Selection behavior and stdout remain unchanged, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Addresses #1932 by making devproxy logs identify its selected instance without changing selection behavior or stdout log output.

Changes:

  • Shares primary-instance selection through StateManager.SelectPrimaryState.
  • Adds a stderr notice identifying the selected PID, other instances, and --pid.
  • Adds selection/notice tests and updates dependency lock files.
File Description
DevProxy/​State/​StateManager.cs Extracts the existing instance-selection logic.
DevProxy/​packages.lock.json Updates transitive dependency records.
DevProxy/​Commands/​LogsCommand.cs Reports automatic instance selection to stderr.
DevProxy.Tests/​LogsCommandTests.cs Covers notice suppression and both selection priorities.
DevProxy.Proxy.Kestrel/​packages.lock.json Updates transitive dependency records.

Review effort: Balanced

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

@copilot build is failing, fix

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>

Copilot AI commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot build is failing, fix

Fixed in f3adea1. The merged dependency updates left two NuGet lock files stale, causing NU1004 during CI restore. Updated those lock files; locked restore, the full solution build (zero warnings/errors), and all 16 DevProxy.Tests tests now pass locally.

waldekmastykarz and others added 2 commits October 21, 2026 12:07
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e60f5fc3-be43-4e01-9202-7c2fc537f546
@waldekmastykarz
waldekmastykarz merged commit e1a7ff2 into main Oct 21, 2026
4 checks passed
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.

devproxy logs silently picks one instance when multiple are running

3 participants