Repository navigation
fix: Force Connect's service log to stdout at INFO level - #74
Merged
Merged
Conversation
with-connect detects startup by reading "Starting HTTP server on" from the container's output. A --config file that sends ServiceLog to a file, or sets ServiceLogLevel above INFO, hides that message and with-connect times out. Set CONNECT_LOGGING_SERVICELOG=STDOUT and CONNECT_LOGGING_SERVICELOGLEVEL=INFO in the container environment, which take precedence over the config file. User -e vars still override them. Fixes #40. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 23, 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.
Fixes #40.
Problem
with-connect tells that Connect has started by reading the container's output for
Starting HTTP server on. That message is an INFO-level line in Connect's service log. If a--configfile sends[Logging] ServiceLogto a file, or setsServiceLogLeveltoWARNorERROR, the message never reaches the container output and with-connect fails with "Posit Connect did not log HTTP server start within 60 seconds."Fix
The container environment includes
CONNECT_LOGGING_SERVICELOG=STDOUTandCONNECT_LOGGING_SERVICELOGLEVEL=INFO. Connect givesCONNECT_*environment variables precedence over the config file. The env setup moved into a smallbuild_container_env()helper so it can be tested directly; user-evars are still applied last, so they can override these defaults.ServiceLogFormat = JSONdoes not need handling: the JSON lines still containStarting HTTP server on [::]:3939andStarting Posit Connect v..., so the existing substring checks match.README documents the forced settings next to the
CONNECT_env var paragraph.Verification with real containers
Used
README.mdas a stand-in license: Connect starts and logs, then with-connect stops at the license check, which comes after the point where the HTTP server line is logged.ghcr.io/posit-dev/connect:latest(2026.10.0)ServiceLog = <file>Starting HTTP server on [::]:3939logged, fails on license as expectedghcr.io/posit-dev/connect:latestServiceLogLevel = WARNStarting HTTP serverline in output (only the license warning, so a valid license would time out)ghcr.io/posit-dev/connect:latestServiceLogFormat = JSON{"level":"info","msg":"Starting HTTP server on [::]:3939",...}matchesghcr.io/posit-dev/connect:latestStarting HTTP server online loggedrstudio/rstudio-connect:jammy-2025.10.0Starting HTTP server online loggedghcr.io/posit-dev/connect:latest-e CONNECT_LOGGING_SERVICELOG=/tmp/x.logA side note from testing: a
--configfile replaces the image's defaultrstudio-connect.gcfgentirely, so it also has to set[HTTP] Listen = :3939(otherwise Connect exits with "No server listeners are configured"). That's outside this fix.Tests
test_container_env_forces_service_log_to_stdout: the bootstrap and logging defaults are present.test_container_env_user_vars_override_defaults:-evalues override the defaults, values containing=are kept, and entries without=are ignored.Both are registered in the
__main__block.uv run test_main.pyandpytestpass.Merge conflicts with open PRs
git merge-treeagainstfix-command-errors(#69),clean-errors(#70), andfast-stop(#71) reports no conflicts. There was no #72 orauto-portbranch to check.🤖 Generated with Claude Code