# How to use logger.info to debug

**URL:** <https://www.ruby-forum.com/t/how-to-use-logger-info-to-debug/125396>\
**Category:** Rails\
**Created:** [January 8, 2008, 8:38pm UTC](https://www.ruby-forum.com/t/how-to-use-logger-info-to-debug/125396 "2008-01-08T20:38:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [January 8, 2008, 8:38pm UTC](https://www.ruby-forum.com/t/how-to-use-logger-info-to-debug/125396/1 "2008-01-08T20:38:57Z")

</div>

How can I use logger.info to output data to development.log so that I  
can then just “tail” that log, rather than getting information  
overload?

It looks to me like the the SELECT resulting from  
FeedsController#add\_some\_tags is causing the  
ActiveRecord::HasManyThroughCantAssociateNewRecords error message, but  
I can’t be sure.

A portion of the log is at  
[http://strawr.googlecode.com/files/development.log](http://strawr.googlecode.com/files/development.log)  
for download, BTW.

Also, why do they write “deprecated” instead of “depreciated”?

-Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [January 8, 2008, 8:41pm UTC](https://www.ruby-forum.com/t/how-to-use-logger-info-to-debug/125396/2 "2008-01-08T20:41:22Z")

</div>

Thufir wrote:

> How can I use logger.info to output data to development.log so that I  
> can then just “tail” that log, rather than getting information  
> overload?

you simply write

logger.info “my text”

and will find “my text” in development.log

or:  
@my\_var = “something”  
logger.info “foo: #{@my\_var}”

to get “foo: something”

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [January 8, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/how-to-use-logger-info-to-debug/125396/3 "2008-01-08T22:00:25Z")

</div>

On Jan 8, 11:41 am, Thorsten M. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:  
[…]

> @my\_var = “something”  
> logger.info “foo: #{@my\_var}”
> 
> to get “foo: something”

Thanks 🙂

When I get home I’ll play around with it. I need to determine why I’m  
getting ActiveRecord::HasManyThroughCantAssociateNewRecords , that the  
records have no id. The records do have an ID field, which isn’t  
null, but somehow that information isn’t getting to where it needs to:

ActiveRecord::HasManyThroughCantAssociateNewRecords in  
FeedsController#add\_some\_tags

Cannot associate new records through ‘Feed#colors’ on ‘#’. Both  
records  
must have an id in order to create the has\_many :through record  
associating them.

-Thufir
