Closed melezhik closed 9 years ago
Agreed. I didn't think about that when I requested custom logger support.
You mean redirect process stdout to syslog?
if you know how to do it with Process#spawn function http://www.ruby-doc.org/core-2.1.2/Process.html#method-c-spawn or may be request this feature from ruby devs.
for example from ruby 2.0 they add :uid, :gid options to that method, by request. (https://bugs.ruby-lang.org/issues/6975)
Outputting to syslog cannot be managed by Process#spawn. It is not simple "redirecting" but writing to a given facility with a given log level and an application name. The process itself should offer the possibility to output to syslog, however many apps don't support it. So it could be interesting to enable it in Eye, even with static facility and level, using SyslogLogger for example (ruby 2.0+).
in rails you may do following:
# cat Gemfile
gem 'syslogger'
# cat config/environments/prodcution.rb
config.logger = Syslogger.new
i think this can be done like this, but this is little hacky:
for daemonize true
:
process :bla do
start_command "sh -c 'ruby -e \"loop { p 1; sleep 0.1}\" | logger'"
daemonize true
use_leaf_child true
end
and eye daemonize it, and would monitor only ruby process (because of use_leaf_child true
), if it die parent shell process die too.
for daemonize false
:
process :bla do
start_command "sh -c 'ruby -e \"loop { p 1; sleep 0.1}\" | logger&'"
end
here would logs to syslog only daemonizer stdout
Thanks, Kostya , but I meant more convenient way to do this.
stdall syslog
would be very usefull