I am working on creating a daemon in Ruby using the daemons gem. I want to add output from the daemon into a log file. I am wondering what is the easiest way to redirect puts from the console to a log file.
I am working on creating a daemon in Ruby using the daemons gem. I
Share
I should recommend to use ruby logger, it is better than puts, you can have multiple log levels that you can turn on/off: debug, warn, info,error, etc.
I use runit package to manage ruby services, it has svlogd than will redirect daemon output to log file, here is run script for logger process: