Search code examples
ruby-on-railsrubylogfiles

How to create rails log file by date?


I am very new to Rails and I really don't like rails default behaviour that it saves all logs in a single log file. Is that possible to archive log file separated by date like development.06-13-2014.log, development.06-14.2014, etc..?

Sorry if I had asked some silly question but I would like to know if there is any way to maintain log file such way.. I appreciate for well explained answers. Thanks :)


Solution

  • you need logrotate - this is a program which runs in the background, and will truncate and rename files on a scheduled basis (eg daily). You won't make any changes to rails itself. Just google logrotate <your OS>