Replace manual logger close calls in postRun with CloseAllLoggers()#4881
Merged
Replace manual logger close calls in postRun with CloseAllLoggers()#4881
Conversation
4 tasks
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/2ec53d5c-97a7-4d65-8b9d-106ff1072f52 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicate logger close calls in postRun function
Replace manual logger close calls in postRun with CloseAllLoggers()
Apr 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies CLI shutdown cleanup by using the centralized logger.CloseAllLoggers() helper in postRun(), ensuring all configured log sinks are closed consistently and close errors are surfaced.
Changes:
- Replace five individual
CloseXxxLogger()calls inpostRun()with a singlelogger.CloseAllLoggers()call. - Log a warning to stderr (via
log.Printf) if any logger close returns an error.
Show a summary per file
| File | Description |
|---|---|
| internal/cmd/root.go | Switches shutdown cleanup to logger.CloseAllLoggers() and reports close errors via log.Printf. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This was referenced Apr 30, 2026
This was referenced May 1, 2026
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
postRun()manually called five individualCloseXxx()functions, duplicating the logic already consolidated inlogger.CloseAllLoggers()— and silently discarding all close errors. Any new logger added toCloseAllLoggers()would be silently skipped at shutdown.Changes
internal/cmd/root.go: Replace five individual close calls withlogger.CloseAllLoggers()and surface errors vialog.PrintfShutdown cleanup now mirrors the single-call pattern already used for initialisation (
InitGatewayLoggers) and will automatically include any future loggers added toCloseAllLoggers().Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build361366619/b513/launcher.test /tmp/go-build361366619/b513/launcher.test -test.testlogfile=/tmp/go-build361366619/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I g_.a -I x_amd64/vet --gdwarf-5 grpcutil -o x_amd64/vet -W .cfg /tmp/go-build3371211061/b151/ x_amd64/vet 1211061/b314/ --gdwarf2 ctor x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build361366619/b495/config.test /tmp/go-build361366619/b495/config.test -test.testlogfile=/tmp/go-build361366619/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build361366619/b396/vet.cfg /idna/go118.go /idna/idna10.0.0.go x_amd64/vet --gdwarf-5 --64 ut-1387901200.c x_amd64/vet --de�� g_.a --debug-prefix-m-ifaceassert x_amd64/vet -I dns -I x_amd64/vet(dns block)nonexistent.local/tmp/go-build361366619/b513/launcher.test /tmp/go-build361366619/b513/launcher.test -test.testlogfile=/tmp/go-build361366619/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I g_.a -I x_amd64/vet --gdwarf-5 grpcutil -o x_amd64/vet -W .cfg /tmp/go-build3371211061/b151/ x_amd64/vet 1211061/b314/ --gdwarf2 ctor x_amd64/vet(dns block)slow.example.com/tmp/go-build361366619/b513/launcher.test /tmp/go-build361366619/b513/launcher.test -test.testlogfile=/tmp/go-build361366619/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I g_.a -I x_amd64/vet --gdwarf-5 grpcutil -o x_amd64/vet -W .cfg /tmp/go-build3371211061/b151/ x_amd64/vet 1211061/b314/ --gdwarf2 ctor x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build361366619/b522/mcp.test /tmp/go-build361366619/b522/mcp.test -test.testlogfile=/tmp/go-build361366619/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s .cfg�� olang.org/grpc@v-errorsas /tmp/go-build337-ifaceassert x_amd64/vet . contextprotocol//usr/bin/runc --64 x_amd64/vet .cfg�� 1211061/b391/_pkg_.a pkg/mod/go.opentelemetry.io/otel@v1.43.0/baggage/context.go x_amd64/vet --gdwarf-5 g/protobuf/encodinfo -o x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: