简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM