# Rails Broadcasting log to Graylog Does not work

**URL:** <https://community.graylog.org/t/rails-broadcasting-log-to-graylog-does-not-work/412>\
**Category:** Graylog Add-ons\
**Created:** [March 10, 2017, 7:14am UTC](https://community.graylog.org/t/rails-broadcasting-log-to-graylog-does-not-work/412 "2017-03-10T07:14:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tessie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/tessie/32/224_2.png) [@tessie](https://community.graylog.org/u/tessie)\
**Post date:** [March 10, 2017, 7:14am UTC](https://community.graylog.org/t/rails-broadcasting-log-to-graylog-does-not-work/412/1 "2017-03-10T07:14:56Z")

</div>

I want to forward all logs to graylog server plus I want to maintain my actual Rails Log. I am using ruby gelf gem. [https://github.com/Graylog2/gelf-rb](https://github.com/Graylog2/gelf-rb) and lograge. In my application.rb I have the code

```auto
if Rails.env.in? ['production', 'preproduction', 'staging']
    config.lograge.keep_original_rails_log = true
    config.lograge.logger = GELF::Logger.new(graylog.example.in", 12219)
end

```

With This I am getting all the request and response in the graylog server.But I does not sent the explict logging logged like these

```auto
Rails.logger.info "#{params}"

```

So I added this code in `application.rb`:

```auto
  gelf = GELF::Logger.new("graylog.example.in", 12219)
  config.logger.extend(ActiveSupport::Logger.broadcast(gelf))

```

This works from rails console.But does not sent from the application

---

<div class="post-metadata">

**Author:** ![tessie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/tessie/32/224_2.png) [@tessie](https://community.graylog.org/u/tessie)\
**Post date:** [March 14, 2017, 4:26pm UTC](https://community.graylog.org/t/rails-broadcasting-log-to-graylog-does-not-work/412/2 "2017-03-14T16:26:51Z")

</div>

I fixed this. Instead of lograge I used a gem log4r and gem ‘log4r-gelf’. log4r is perfect for multiple output destination per log.

This is how I did it

> **[Scalable Logging in Rails using Log4r and graylog](https://tessjohn.wordpress.com/2017/03/13/log4r-for-ruby-on-rails/)**
>
> Rails default logger is quite simple.but it becomes quite difficult to debug in production as the app grows big. Imagine  you have 5 different app servers and you have to grep all the log files. So…
