Forum: Ruby Ruby/Rails Logger

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
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.
This topic is locked and can not be replied to.