From: Ken Burgett Date: 2009-08-01T07:28:17+09:00 Subject: Re: debugging messages from a daemon program --0016368e1ff3de886c047007d5d6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I just did some development on a daemon, and I understand your pain. I had some luck using the ENV hash: ENV['logger'] = Logger.now(...) 2009/7/31 Will Parsons > I'm developing a daemon written in Ruby and in the course of development I > like to see various status messages printed at crucial points to aid in > debugging. Since this is a daemon, I use syslog and create a global $log > variable to handle log messages, essentially like the following: > > require 'syslog' > ... > $log = Syslog.open('progname', Syslog::LOG_PID, log_facility) > ... > $log.debug some_message > > This has worked well as long as the whole program is contained in a single > file, but as the program has gradually increased in complexity, I wish to > remove the definition of some classes to their own files and "require" them > in the main ruby source file. This means that whatever is removed to a > separate file no longer has access to the global variable $log. Any > suggestions on how to best handle status/debug messages from these > subsidiary files? > > -- > Will > > -- Regards, Ken Seek wisdom through disbelief --0016368e1ff3de886c047007d5d6--