Log every SQL query to database in Rails

后端 未结 6 1530
梦毁少年i
梦毁少年i 2020-12-03 17:40

I want to save to a log file some SQL query rails performs, (namely the CREATE, UPDATE and DELETE ones) therefore I need to intercept all queries and then filter them maybe

6条回答
  •  佛祖请我去吃肉
    2020-12-03 18:11

    SQL Server? If so...

    Actually, I'd do this at the SQL end. You could set up a trace, and collect every query that comes through a connection with a particular Application Name. If you save it to a table, you can easily query that table later.

提交回复
热议问题