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

Does withSimpleStdOutLogger ever flush? #38

Closed
linearray opened this issue Sep 1, 2017 · 3 comments
Closed

Does withSimpleStdOutLogger ever flush? #38

linearray opened this issue Sep 1, 2017 · 3 comments
Assignees

Comments

@linearray
Copy link
Contributor

I'm using a custom logger that is based on (withSimple)stdoutLogger:

stdoutLogger :: IO Logger

I debugged an issue today concerning log messages appearing 15 minutes in the log after the message was actually emitted. I traced it back to GHC using block-buffering for stdout, if the FD is not associated with a TTY, which is the case for my service since it is managed by systemd. Now I wonder: Does the provided StandardOutput logger ever flush, because after looking at the code I don't think so.

Is this considered out of scope and applications are expected to set the correct buffering on stdout themselves (or call hFlush in the logging action)?

@jonathanjouty
Copy link
Contributor

IIRC it is out of scope and must be set on stdout
I'll let @23Skidoo give a definitive answer when he's back from ICFP :)

@23Skidoo
Copy link
Contributor

Given that we provide our own BulkStdoutLogger, I think we should make stdout loggers flush on each write (bulk write in the case of the bulk logger), plus make them flush on exit. I'll write a patch.

@23Skidoo
Copy link
Contributor

Released log-base-0.7.3.0 on Hackage.

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

No branches or pull requests

3 participants