Demo app loggin#4849
Merged
aaltat merged 7 commits intoMarketSquare:mainfrom Apr 25, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds request logging to the dynamic test app and captures its output into per-port log files to make debugging automated test runs easier.
Changes:
- Add
morgan(and types) and bump@yao-pkg/pkg. - Enable HTTP request logging middleware in
node/dynamic-test-appserver. - Redirect test server stdout/stderr into
atest/output/test-app/test-app-<port>.logand close logs on shutdown.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.json | Adds morgan (+ types) to support request logging; bumps @yao-pkg/pkg. |
| package-lock.json | Lockfile updates reflecting new/updated npm dependencies. |
| node/dynamic-test-app/src/server.ts | Wires morgan into the Express app to log requests. |
| atest/library/common.py | Redirects test server output to log files and closes them in stop_test_server. |
Comment on lines
105
to
+114
| if port in SERVERS: | ||
| p: Popen = SERVERS[port] | ||
| close_process_tree(p) | ||
| del SERVERS[port] | ||
| else: | ||
| logger.warn(f"Server with port {port} not found") | ||
| if port in LOG_FILES: | ||
| LOG_FILES[port].flush() | ||
| LOG_FILES[port].close() | ||
| del LOG_FILES[port] |
There was a problem hiding this comment.
In stop_test_server, if close_process_tree(p) raises (e.g., psutil AccessDenied/other unexpected errors), the corresponding log file handle in LOG_FILES will not be flushed/closed because that cleanup happens after the process shutdown block. Consider wrapping the process shutdown in a try/finally (or otherwise guaranteeing log-file cleanup) so log handles don’t leak on teardown failures.
Suggested change
| if port in SERVERS: | |
| p: Popen = SERVERS[port] | |
| close_process_tree(p) | |
| del SERVERS[port] | |
| else: | |
| logger.warn(f"Server with port {port} not found") | |
| if port in LOG_FILES: | |
| LOG_FILES[port].flush() | |
| LOG_FILES[port].close() | |
| del LOG_FILES[port] | |
| try: | |
| if port in SERVERS: | |
| p: Popen = SERVERS[port] | |
| close_process_tree(p) | |
| del SERVERS[port] | |
| else: | |
| logger.warn(f"Server with port {port} not found") | |
| finally: | |
| if port in LOG_FILES: | |
| LOG_FILES[port].flush() | |
| LOG_FILES[port].close() | |
| del LOG_FILES[port] |
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.
No description provided.