Closed lzap closed 8 years ago
Oh the https://github.com/phemmer/ruby-syslogio is not actually a gem, pulled that in, need to clarify the license tho.
Some tests fail because of new development gem incompatibility tho.
Also alternatively, there is a trick to use Syslog::Logger (Ruby 2.0+ only) as an IO object:
require 'syslog/logger'
::Syslog::Logger.class_eval { alias_method :write, :info }
I added MIT license to phemmer/ruby-syslogio. MIT license is compatible with BSD license. So you're good to do with it as you like :-)
Thanks. @thuehlinger do you like this and should I finish the code?
I'm fine with it. @lzap please go on.
Pushed my prototype, let's see how tests goes first.
Seems to look fine, apart from the tests that fail because of missing byebug. Right?
Sorry for the delay, it was on my radar, thanks!
When using daemons with SELinux confined domain, there is a file descriptor leak when daemon output is redirected to a file which is a good practice. This patch tries to redirect stdout/err to syslog if it's available in case log_output is not set, then it falls back to /dev/null. It uses a small gem syslogio for the IO wrapper, if you don't like new dep we could pull this in the project.
Also the patch changes usage of STD* constants in favor of global variables, which is the preferred way of redirecting. This code is untested, let's discuss how you like this.