Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify log printing in localstack start command #9166

Merged
merged 2 commits into from Sep 18, 2023
Merged

Conversation

thrau
Copy link
Member

@thrau thrau commented Sep 15, 2023

Motivation

An enterprise user noticed that when using EXTENSION_DEV_MODE=1 is set, the information is not printed correctly to the logs when using localstack start.
I couldn't really find the root cause, but it seems to have something to do with echo calls in the docker-entrypoint.sh not showing up in the default outfile, which is the mechanism we use to dump the docker logs.
We then listen on those logs using a FileListener.

That seemed a bit roundabout to me now that we have stream_container_logs, so I removed the FileListener logic alltogether, and just wait for the container to start and then start printing the logs from there.
Since docker logs -f prints all the previous logs, it's a pretty robust solution.

I also found an issue where we didn't pass the Container instance to the LocalstackContainerServer.

Changes

  • Remove FileListener and replace it with ContainerLogPrinter
  • Change the bootstrap logic of localstack start accordingly
  • Update LocalstackContainerServer to also take a Container instance

@thrau thrau requested a review from simonrw September 15, 2023 15:12
@thrau thrau added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Sep 15, 2023
@thrau thrau added this to the 2.3 milestone Sep 15, 2023
@coveralls
Copy link

coveralls commented Sep 15, 2023

Coverage Status

coverage: 80.08% (-0.05%) from 80.128% when pulling ccf50bd on simplify-start-logging into 858bbf2 on master.

@github-actions
Copy link

LocalStack Community integration with Pro

       2 files  ±0         2 suites  ±0   1h 14m 18s ⏱️ - 2m 13s
2 209 tests ±0  1 713 ✔️ ±0  496 💤 ±0  0 ±0 
2 210 runs  ±0  1 713 ✔️ ±0  497 💤 ±0  0 ±0 

Results for commit 2e62049. ± Comparison against base commit 858bbf2.

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Does this mean we can remove default_run_outfile as well?

@thrau
Copy link
Member Author

thrau commented Sep 18, 2023

@simonrw i think i would argue to keep it since it keeps the log file of the last run around in the localstack volume which may be useful. since we remove the container there would be no way of inspect logs after it shuts down

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Nice set of changes, and the implementation seems to work nicely

localstack/utils/bootstrap.py Show resolved Hide resolved
localstack/utils/bootstrap.py Show resolved Hide resolved
localstack/utils/bootstrap.py Show resolved Hide resolved
@thrau thrau merged commit 2524c99 into master Sep 18, 2023
19 of 23 checks passed
@thrau thrau deleted the simplify-start-logging branch September 18, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants