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

Incomplete log output #11

Open
ecampidoglio opened this issue Oct 19, 2023 · 0 comments · May be fixed by #12
Open

Incomplete log output #11

ecampidoglio opened this issue Oct 19, 2023 · 0 comments · May be fixed by #12

Comments

@ecampidoglio
Copy link

Description

The sink produces missing or partial console output when the current size of the log is less than the size of the buffer of the StreamWriter used to write to the console's stdout stream.

Expected behavior

Each log message should appear in the console in its entirety shortly after it has been generated by the application.

Actual behavior

The last line in the console output contains a partial log message. Generating more log messages completes the line.

Steps to reproduce

  1. Start the DemoApp
  2. Notice that no output appears in the console
  3. Send an HTTP GET request to http://localhost:5000
  4. Notice that the last line in the console output shows an incomplete log message
  5. Send another GET request to http://localhost:5000
  6. The incomplete log message now appears in its entirety

The screenshot below shows an example of how it might look like in step 4:

serilog-sinks-fastconsole-incomplete-log

Known workarounds

Generating a constant stream of log messages does not expose this bug.

ecampidoglio added a commit to ecampidoglio/serilog-sinks-fastconsole that referenced this issue Oct 19, 2023
This commit ensures that log messages are printed to the console's
stdout in their entirety by flushing the internal buffer of the
`StreamWriter` after every write operation.
@ecampidoglio ecampidoglio linked a pull request Oct 19, 2023 that will close this issue
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 a pull request may close this issue.

1 participant