No stdout/stderror output when running Haskell application in Kubernetes No stdout/stderror output when running Haskell application in Kubernetes kubernetes kubernetes

No stdout/stderror output when running Haskell application in Kubernetes


It seems this is caused by the output buffering being set in "block" mode when being output to the kubernetes logging.

Fixed via setting the buffering to LineBuffering:

import System.IO...  hSetBuffering stdout LineBuffering  hSetBuffering stderr LineBuffering

http://hackage.haskell.org/package/base-4.12.0.0/docs/System-IO.html#t:BufferMode

The default buffering mode when a handle is opened is implementation-dependent and may depend on the file system object which is attached to that handle. For most implementations, physical files will normally be block-buffered and terminals will normally be line-buffered.

Thanks to Jesse Kempf from the fp slack for pointing me to this!