Log file option
Syslog support was added in #105 but that issue also asked for a log file option. I'd like this also.
Why do I want this? I'm in an old-school CentOS 5 & 6 init.d based environment. Snazzy new things like systemd and upstart aren't available which probably do a good job of capturing stdout/stderr to a file. runit is a possibility but I'm not thrilled about building and installing that just for Consul.
So what's exactly the problem? I can only log to a file now through appending stdout & stderr to a file and backgrounding the Consul process. Works great... until I want to use logrotate to rotate that file. I realized the only way I can release the file handle is a hard restart of Consul. That's not ideal, but possible. And then I realized, if I want to rotate logs regularly by time instead of size, all of my Consul agents could potentially be hard restarted at the same time by logrotate in order to release the file handle. Ouch.
I'm using syslog as a workaround, and perhaps could have syslogd log to a different file, but an explicit log file would be far simpler.
Implementing different logging destinations in an application is generally not a good idea, IMO. There are many different requirements by different environments that could be easily (and should be) done by separate tools. If you don't mind nodejs, you can take a look at https://github.com/dstokes/logrotate-stream. I think there should be many similar tools out there.
The stock logrotate can also perform a copy/truncate operations which is friendlier to a process that keeps the output file open.
Thanks, I didn't know copy+truncate in logrotate. That's an option. And in that case this is just a "nice to have".
The main reason I filed an issue is because it was part of the request in #105 but was not implemented there.
Agreed. For now, we'd prefer this problem to be handled outside of Consul using external tools.