# Daemonize/daemons causing IOError. Help?

**URL:** <https://www.ruby-forum.com/t/daemonize-daemons-causing-ioerror-help/169808>\
**Category:** Rails\
**Created:** [June 9, 2009, 4:29am UTC](https://www.ruby-forum.com/t/daemonize-daemons-causing-ioerror-help/169808 "2009-06-09T04:29:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/2bfe46/32.png) [@cpher](https://www.ruby-forum.com/u/cpher)\
**Post date:** [June 9, 2009, 4:29am UTC](https://www.ruby-forum.com/t/daemonize-daemons-causing-ioerror-help/169808/1 "2009-06-09T04:29:17Z")

</div>

Anyone have any idea why this error is occuring?

[http://pastie.org/505297](http://pastie.org/505297)

I am creating a plugin that provides a configurable logger. When I set  
the logger to be Logger.new(STDOUT), things work fine. When I set it to  
be Rails.logger, I get the above message.

Any insight?

I appreciate it.  
-Chris

---

<div class="post-metadata">

**Author:** ![cpher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/2bfe46/32.png) [@cpher](https://www.ruby-forum.com/u/cpher)\
**Post date:** [June 10, 2009, 12:41am UTC](https://www.ruby-forum.com/t/daemonize-daemons-causing-ioerror-help/169808/2 "2009-06-10T00:41:48Z")

</div>

Chris J. wrote:

> Anyone have any idea why this error is occuring?
> 
> [http://pastie.org/505297](http://pastie.org/505297)
> 
> I am creating a plugin that provides a configurable logger. When I set  
> the logger to be Logger.new(STDOUT), things work fine. When I set it to  
> be Rails.logger, I get the above message.
> 
> Any insight?
> 
> I appreciate it.  
> -Chris

For the record, I fixed this by delaying the loading of the Rails  
environment until within the daemonized process.

Got the idea from here:  
[http://www.elevatedrails.com/articles/2008/12/02/daemonizing-rails/](http://www.elevatedrails.com/articles/2008/12/02/daemonizing-rails/)

-Chris
