Skip to content

Logfile empty when running Syncthing using start command from CMD in Windows #10882

Closed

Description

@tomasz1986

What happened?

I assume this is some kind of a Windows-specific quirk, but when starting Syncthing from the command line (cmd.exe) as follows

start "" syncthing.exe

the log is not saved to the disk. It doesn't matter if it's the default location or a specific location set with --log-file=<filename>, the logfile just stays at 0 bytes all the time. This isn't the case when Syncthing is run without the start command.

I will try to do more testing later on, but I assume the problem may be related to #10726, as I've been using the same method to start Syncthing for years and I can say for sure that the logfile used to be written to the disk just fine.

@Shablone Have you perhaps got any idea what the culprit may be here?

Syncthing version

2.1.5

Platform & operating system

Windows

Browser version

N/A

Relevant log output

Activity

  1. added
    bug
    needs-triage
    on Sep 13, 2026
  2. added theissue type on Sep 13, 2026
  3. removed
    needs-triage
    on Sep 13, 2026
  4. Shablone commented on Sep 15, 2026

    @Shablone
    Contributor

    Same here. On 2.1.1 it still logs, while on 2.1.2 it doesn't anymore.
    I haven't looked into it deeply enough yet to have any idea why.

  5. calmh commented on Sep 16, 2026

    @calmh
    Member

    What's the purpose of using the start incantation?

  6. tomasz1986 commented on Sep 16, 2026

    @tomasz1986
    MemberAuthor

    It has multiple functions but when run with no arguments like that, it detaches the process from the current command line window (or rather starts it outside of the current window).

  7. Shablone commented on Sep 16, 2026

    @Shablone
    Contributor

    Current insight:
    Syncthing not only tries to log to the file, but also to stdout.
    The stdout handle is probably invalid in this scenario due to the policy.
    ->Syncthings logwriter first tries stdout then the file, but already fails silently for the stdout.

    And it seems that this is also the case for Syncthing opened via double click 😱

    I'll try to get a fix ready. Sry for your missing log 😬

  8. Shablone commented on Sep 16, 2026

    @Shablone
    Contributor

    So.. Currently I'm not allowed to open a PR, probably due to the new AI guidelines. Understandably.

    I prepared a fix here
    I reviewed and tested it. This solved the issue and logging will continue to work from console, ' start "" syncthing.exe ' and explorer.

    But I have to admit that this is heavily inspired by AI and I'm still not deeply connected to the repo. So I do understand if this is not accepted.

    The change will allow the logwriter to continue on other file handles after a failed write.

    An alternative fix could be, letting the file be written first and stdout second, but this seems quirky.
    Another alternative: Check if stdout is valid and skip its write otherwise. I haven't found a proper solution for that.
    Another alternative: Check if we have that specific Windows scenario and skip that write. But that also seems quirky

  9. calmh commented on Sep 16, 2026

    @calmh
    Member

    @Shablone I've sent you an invite so you can create a normal PR, we can discuss there.

  10. added a commit that references this issue on Sep 22, 2026
    5c0a725
  11. added a commit that references this issue on Sep 30, 2026
    2c560c2
  12. added a commit that references this issue on Oct 19, 2026
    7888d0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions