How can i change the logger for a subset of ActiveRecord models?

Lets say i have two different ApplicationRecords, both of which are abstract classes. For models that inherit from ApplicationRecord1 i want to use the standard Rails.logger but ApplicationRecord2, i want those query logs to not go to STDOUT and to a different log file. I tried setting ApplicationRecord2.logger to a new logger instance but it was still using ActiveRecord::Base’s logger.

1 Like

What’s code you wrote for ApplicationRecord2 to change the logger?