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

Show Python container logs locally #178

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

kentbull
Copy link
Collaborator

@kentbull kentbull commented Dec 11, 2023

By default in non-interactive mode, when not run as an interactive script, Python doesn't flush the log buffer to stdout or stderr. This means you need to set PYTHONUNBUFFERED=1 to ensure that the output is not buffered, which means it is immediately flushed to stdout or stderr.

In containers this is needed as it makes viewing logs in real-time reliable and consistent.

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (858dea2) 81.42% compared to head (751b9dd) 81.42%.

❗ Current head 751b9dd differs from pull request most recent head a8de62f. Consider uploading reports for the commit a8de62f to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #178   +/-   ##
============================================
  Coverage        81.42%   81.42%           
============================================
  Files               46       46           
  Lines             4141     4141           
  Branches          1030     1030           
============================================
  Hits              3372     3372           
  Misses             737      737           
  Partials            32       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@psteniusubi
Copy link
Contributor

Please also add to vlei-server. Looks good otherwise.

I was wondering why logs were not printing on the console. Nice catch thanks!

By default in non-interactive mode, when not run as an interactive script, Python doesn't flush the log buffer to stdout or stderr. This means you need to set PYTHONUNBUFFERED=1 tp ensure that the output is not buffered, which means it is immediately flushed to stdout or stderr.
@kentbull kentbull force-pushed the enable-local-container-logs branch from 751b9dd to a8de62f Compare December 12, 2023 15:14
@kentbull
Copy link
Collaborator Author

This has been added to the vlei-server now.

@lenkan lenkan self-requested a review December 12, 2023 16:50
@lenkan lenkan merged commit 517b981 into WebOfTrust:development Dec 12, 2023
3 checks passed
@kentbull kentbull deleted the enable-local-container-logs branch December 12, 2023 22:35
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.

3 participants