Logging/stdout issue

Hi! I have been having logging issues where the output of my program was missing from the web dashboard and fly logs. I first thought there was another issue with my app but I was able to create a simple image reproducing the problem.

The executable Swift code consists of the following:

import Glibc

var total = ""

while true {
    total += "\(total.count) "

I rarely see the output in the logs. Sometimes it seems that the output appears at the moment the instance is shutdown.

I tried redirecting the output to a file:

CMD release/FlyLogsTest >> /tmp/output.txt

But I still see erratic behavior: it seems the file isn’t always filled instantly, and once it is, it sometimes gets truncated.

This is Swift code running on base ubuntu:focal image, I also published a deployable repo that exhibits the issue when redirecting the standard output to a file.

This is a very puzzling issue: I never had issues logging anything on Fly nor did I ever have any issues printing anything with Swift.

Would someone have an idea of what might be causing this?

Thank you

This is actually an issue related to Swift where stdout doesn’t seem to get flushed, closing this thread.

1 Like