Running the Linux server build of UE5 and observing that log output to stdout is being flushed every 4k.
Is there a configuration to disable buffering of log output to stdout? If not, what are my options for writing output unbuffered to stdout?
Running the Linux server build of UE5 and observing that log output to stdout is being flushed every 4k.
Is there a configuration to disable buffering of log output to stdout? If not, what are my options for writing output unbuffered to stdout?
I know I’m necrobumping this but I ran into this also.
It looks like Engine/Source/Runtime/ApplicationCore/Private/Linux/LinuxConsoleOutputDevice.cpp is what’s handling the logging to stdout here. There is no manual flushing so standard stdout buffering will defer here. If you’re running the UE server without a TTY (not via a terminal, e.g. in Kubernetes or Docker), it’s up to the compiler implementation, which typically is 8k or 4k in our case. So you can either attach a TTY to defer to line-buffering (flushes after \n or manually add fflush(stdout) after the printf.
Another potential option is to use the CLI flag -stdout, which will defer to the FOutputDeviceStdOutput device in Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp, which already has a fflush(stdout) after each line, though it seems like the logging is more limited in this mode.
A totally separate solution (which is what I went with) is use a 3rd party program like stdbuf -oL -eL <program> to force line buffering for both stdout and stderr