# Using Rails.Logger in a gem in Rails 3beta3

**URL:** <https://www.ruby-forum.com/t/using-rails-logger-in-a-gem-in-rails-3beta3/187011>\
**Category:** Rails\
**Created:** [April 15, 2010, 5:29pm UTC](https://www.ruby-forum.com/t/using-rails-logger-in-a-gem-in-rails-3beta3/187011 "2010-04-15T17:29:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![k-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/db5fbb/32.png) [@k-b](https://www.ruby-forum.com/u/k-b)\
**Post date:** [April 15, 2010, 5:29pm UTC](https://www.ruby-forum.com/t/using-rails-logger-in-a-gem-in-rails-3beta3/187011/1 "2010-04-15T17:29:27Z")

</div>

Hi fellows!

I want to use the Rails.logger in my gem. I try the following code in  
my main gem-file.

require ‘rails/logger’  
puts “init1”  
::Rails.logger.info(“hi”)  
puts “init2”

The funny thing is: It even don’t give me the output of puts in the  
stdout of the server!  
But if I remove the call to Rails.logger the puts are displayed in the  
stdout of the server again.

But in both cases nothing is written in the development.log

Greetings from Germany,  
Klaus

---

<div class="post-metadata">

**Author:** ![k-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/db5fbb/32.png) [@k-b](https://www.ruby-forum.com/u/k-b)\
**Post date:** [April 15, 2010, 5:42pm UTC](https://www.ruby-forum.com/t/using-rails-logger-in-a-gem-in-rails-3beta3/187011/2 "2010-04-15T17:42:19Z")

</div>

Ok i figured out something.

The whole thing, that the puts are not displayed is the problem with  
the require ‘rails/logger’ line. If I don’t require rails/logger I can  
use my plain old stdouts.

That may be intended like this … but how can I use the Rails.logger  
through my gem?
