# Setting up my own logger for Rails

**URL:** <https://www.ruby-forum.com/t/setting-up-my-own-logger-for-rails/129963>\
**Category:** Rails\
**Created:** [February 23, 2008, 2:29am UTC](https://www.ruby-forum.com/t/setting-up-my-own-logger-for-rails/129963 "2008-02-23T02:29:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![soroe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@soroe](https://www.ruby-forum.com/u/soroe)\
**Post date:** [February 23, 2008, 2:29am UTC](https://www.ruby-forum.com/t/setting-up-my-own-logger-for-rails/129963/1 "2008-02-23T02:29:16Z")

</div>

Hey Guys,

I’m running a script that accesses Rails models via script/runner. I  
want to accumulate the log message in a different logfile to avoid  
polluting the development/test/production.log files. I’ve tried both to  
no avail:

ActiveRecord::Base.logger = Logger.new(filename)  
ActionController::Base.logger = Logger.new(filename)  
logger = = Logger.new(filename)

In all cases, the log messages continue to appear in the  
development/test/production.log file.

Any pointers would be appreciated.

Sonny.

---

<div class="post-metadata">

**Author:** ![soroe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@soroe](https://www.ruby-forum.com/u/soroe)\
**Post date:** [February 23, 2008, 8:50pm UTC](https://www.ruby-forum.com/t/setting-up-my-own-logger-for-rails/129963/2 "2008-02-23T20:50:21Z")

</div>

Sonny C. wrote:

> Hey Guys,

> Any pointers would be appreciated.
> 
> Sonny.

you can change it through the config in environment/config.rb  
try: config.logger = Logger.new(‘logger path’, Logger::DEBUG)

hth

ilan

---

<div class="post-metadata">

**Author:** ![soroe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@soroe](https://www.ruby-forum.com/u/soroe)\
**Post date:** [February 23, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/setting-up-my-own-logger-for-rails/129963/3 "2008-02-23T23:13:46Z")

</div>

> you can change it through the config in environment/config.rb  
> try: config.logger = Logger.new(‘logger path’, Logger::DEBUG)

Thanks for the suggestion but no better luck:"( I’m running my script  
through script/runner incidentally…
