Stdout sucks for logging

Syncthing really needs a proper logging method. Simply sending to stdout sucks, because when it restarts (either for new version or manually), the stdout is changed and if you were saving it to a log file, all future entries are lost

That’s not true, stdout is preserved between restarts, because we fork our own process - we inherit parents stdout.

I think I saw that the logging didn’t show anything any more on windows, when Syncthing restarts during an upgrade. I will check this again, when I am at home.

Windows has a magical -log flag.

Stdout rocks for logging. In the nineties we used to do magic steps to “daemonize”, manage PID files, write to log files and whatnot. And then have a bunch of flags to disable that crap when running interactively for whatever reason (debugging or developing).

Best practice today is to not daemonize, not care about PID files, exit on termination signals and log to stdout. That way your process manager – SMF, systemd, runit, launchd, whatever – can decide how best to start, stop and log output.

However Windows is different. So there we do create a log file because otherwise the log output probably just disappears into cyberspace. It doesn’t get nuked on restarts though.


stdout is great for docker – makes life amazing…


Yes, it is very annoying when Windows console message goes away on upgrades. Maybe syncthing should have some supervisor thread for stdout management.

Syncthing does have exactly that. But perhaps stdout handing is different/broken on Windows…

4 posts were split to a new topic: Windows console window and restarts

I don’t want to see this topic in my new list any more