Search code examples
ruby-on-railslogginglog-level

Rails log levels to files


I want to log warn messages to a file like warn.log, error messages to a file like error.log. I've googled so many pages and also the StackOverFlow, but I didn't find some parallel topics. Do you have any good suggestions?


Solution

  • Use this gem multi_level_logger

    Add the following in your config/environments/production.rb

    config.logger =  MultiLevelLogger::MLogger.create(:all=>true)
    

    Now your logs will be written into separate files. And your default logger will be disabled.

    For more info check here