You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It turned out that GHC by default does "no buffering" for stderr, and for hslogger this might be a huge performance-bottleneck.
Here's an example of a script that confirms performance problems: https://gist.github.com/k-bx/ccf6fd1c73680c8a4345 (please, don't pay any attention to "timeout" thing, initiall I thought the problem lies in concurrent usage of hslogger).
In order to resolve problem, you can either manually put hSetBuffering stderr LineBuffering in your program, or disable logging to stderr at all.
I think that hslogger should do its best in order to not put a person into a situation when logging consumes huge amount of time, and I would propose to somehow determine that user is willing to use logging to stderr and in that case doing hSetBuffering stderr LineBuffering in order to switch buffering to LineBuffering mode.
The text was updated successfully, but these errors were encountered:
I would be open to documenting this. However, I do not think that hslogger changing the behavior of stderr is a desired side-effect. The user could easily enough do that themselves if that's what they want.
I've just run into this problem too. Stumbled on to this issue with some googling. I am getting log messages interleaved character for character when logging to stderr. I'll try hSetBuffering stderr LineBuffering.
It turned out that GHC by default does "no buffering" for stderr, and for hslogger this might be a huge performance-bottleneck.
Here's an example of a script that confirms performance problems: https://gist.github.com/k-bx/ccf6fd1c73680c8a4345 (please, don't pay any attention to "timeout" thing, initiall I thought the problem lies in concurrent usage of hslogger).
In order to resolve problem, you can either manually put
hSetBuffering stderr LineBuffering
in your program, or disable logging to stderr at all.I think that hslogger should do its best in order to not put a person into a situation when logging consumes huge amount of time, and I would propose to somehow determine that user is willing to use logging to stderr and in that case doing
hSetBuffering stderr LineBuffering
in order to switch buffering toLineBuffering
mode.The text was updated successfully, but these errors were encountered: