Forum: Ruby Ruby/Rails Logger

6a833ca1d8de0cca43216c0d2f8372ff?d=identicon&s=25 Jo Neil (onjey_neil)
on 2017-01-04 11:14
Is there any way to override Logger in order to save logs to database.,
I know how to put results to file or to console/stdout, however I
haven't found any information how to store logs to database., in my case
I need put logs only to DB, and I don't need put logs to stdout and

In my understanding I need override Logger to add logic which will
responsible for DB operation, then replace standard Rails logger in

config.logger =

However I don't know how to override/create Logger which will work with

I tried, like so

class MyDBLogger < Logger
  def initialize(*args)

  def add(*args)
    # save to db

However in add method I don't see all comments which exists in console.

Thanks in advance.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.