# Daily logger not working?

**URL:** <https://www.ruby-forum.com/t/daily-logger-not-working/88204>\
**Category:** Rails\
**Created:** [March 8, 2007, 10:31pm UTC](https://www.ruby-forum.com/t/daily-logger-not-working/88204 "2007-03-08T22:31:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [March 8, 2007, 10:31pm UTC](https://www.ruby-forum.com/t/daily-logger-not-working/88204/1 "2007-03-08T22:31:21Z")

</div>

Hi,

In my controller I have given:

logger = Logger.new(‘try.log’, shift\_age=‘daily’)

A file is created in the root folder of my application as try.log.

But if I give logger.info(‘testing’) then this is logged in  
development.log instead of try.log. Am I missing some setup?

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [March 9, 2007, 2:34am UTC](https://www.ruby-forum.com/t/daily-logger-not-working/88204/2 "2007-03-09T02:34:45Z")

</div>

If you want a controller specific logger, you should over-write the  
the inherited @logger attribute and provide an accessor for it.

attr\_accessor :logger  
def initialize  
super  
@logger = Logger.new(‘try.log’)  
end

…

If you want a rails-wide logger over-ride, you’ll need to do it in  
config/environment\*

One caveat – in clustered setups using Ruby-specific log rotation is  
a huge no-no and will cause you massive headaches in the future. You  
should rely on some sort of external log rotation solution (logrotate,  
etc) for those.

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [March 9, 2007, 3:19am UTC](https://www.ruby-forum.com/t/daily-logger-not-working/88204/3 "2007-03-09T03:19:34Z")

</div>

Can you point me as to where I can get an idea of external log rotation?

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [March 9, 2007, 3:51am UTC](https://www.ruby-forum.com/t/daily-logger-not-working/88204/4 "2007-03-09T03:51:55Z")

</div>

There are a few packages out there. This is what I use:  
[http://iain.cx/src/logrotate/](http://iain.cx/src/logrotate/)
