How to log something in Rails in an independent log file?
You can create a Logger object yourself from inside any model. Just pass the file name to the constructor and use the object like the usual Rails logger: class User < ActiveRecord::Base def my_logger @@my_logger ||= Logger.new(“#{Rails.root}/log/my.log”) end def before_save my_logger.info(“Creating user with name #{self.name}”) end end Here I used a class attribute to memoize … Read more