Logging to several files


#1

I realized that despite the fact that I give syncthing a logfile via its commandline it continues to log to stdout, leading to log entries being placed in my logfile as well as in daemon.log and syslog. How do I prevent that? Of course I want syncthing to log to one file only! Syncthing is started like so:

ExecStart=/usr/bin/syncthing -no-browser -logfile=/var/log/syncthing/syncthing.log -logflags=3

What else do I need to do to stop it from spamming syslog?

THX

Don


(Audrius Butkevicius) #2

Googling this probably would have been less effort than creating a forum post:


(Simon) #3

I don’t think this applies here, as with -logfile specified nothing should be written to stdout and thus handled by systemd at all.


(Jakob Borg) #4

We always log to stdout as well.


(Simon) #5

Good to know - that isn’t intuitively clear (to me) as the help text on -logfile explicitly mentions (use "-" for stdout).


(Jakob Borg) #6

Yeah. I think that’s more about having a default value for it that actually does what we do by default. The use case is for Windows, really, where getting log data to a file isn’t as easy as on Unixes. And there you might want to have data both logged and actually visible if you run it manually. Using it under systemd doesn’t make total sense to me, but to each their own.


(Simon) #7

Agree, I think in this case it is less of a conscious choice but a combination of a packager who uses systemd but doesn’t really know it and a user trying to fix the packagers mess…

I didn’t intend to propose changing the behaviour, just making it explicit in the help text: https://github.com/syncthing/syncthing/pull/4796


#8

Googling this probably would have been less effort than creating a forum post

Before posting I spent half a hour googling for a solution. Seems I didn’t throw the right keywords at the engine…


#9

Yep, that’s the important item that I was missing and that’s not mentioned in the doc. I was expecting the switch was redirecting the log, not splitting it. Thus I was a bit confused. I agree with Simon, let’s put that fact in the help and maybe also mention that this switch is mainly intended for Windoze and likely counterproductive for Linux.

I meanwhile removed the -logfile switch and was able to do the direction in the way I desired. So this item is solved. THX for all your help!


(system) #10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.