How do I set options for logging output in ruby gem Daemons?

1k views Asked by At

I am using Daemons 1.1.9. I am not able to get the daemons logging to a log file. My daemons control file is as follows:

require 'rubygems'
require 'daemons'

@options = {
  :dir_mode   => :script,
  :dir        => 'pids',
  :multiple   => false,
  :backtrace  => true,
  :monitor    => false,
  :log_dir    => 'log',
  :log_output => true
}

Daemons.run('myserver.rb', @options)

The pids and log directories are both just one down from the root folder and the pid files are being written successfully so I know it's not a misspecification of the directory/directory mode. The files, myserver.rb.log and myserver.rb.output, exist in the log directory. What am I doing wrong? Thanks in advance.

1

There are 1 answers

0
TheFiddlerWins On

The following worked for me, I am not much of a ruby guy so this may be a terrible hack.

Daemons.run_proc(
'parse-file', # name of daemon
:log_output => true,
:output_logfilename => "parse-file.log",
:logfilename => "parse-file.log"
)