Ruby/Rails Logger

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.