logo       

Re: debugging messages from a daemon program: msg#02423

ruby-talk

Subject: Re: debugging messages from a daemon program

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 <oudeis@xxxxxxxxxxxxxxxx>

> 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
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise