1

i am using like this, config.logger = Logger.new(Rails.root.join('log', "#{Rails.env}.log"), 10, 10*1024). Its working perfectly.It clear the log the file reach 10240bytes.

i taken back up of the log file, the name of the file is "development.log.0","development.log.1".. Now i want "development.log.0.2012-09-24"(that is i want to add Time.now at the end of the file name. Can any one help me??

2 Answers 2

1

This is entirely dependent upon the stack you're deploying to, but I'm of the opinion that rotating logs shouldn't be a concern of your Rails app. I would recommend doing this at the OS level using logrotate (if you're on *nix) scheduled daily via cron.

http://linuxcommand.org/man_pages/logrotate8.html

Sign up to request clarification or add additional context in comments.

Comments

0

Try this

config.logger = Logger.new(Rails.root.join('log', "#{Rails.env}.log.#{Date.today.to_s}"), 10, 10*1024)

1 Comment

for default development.log file should be "development.log", from next one on wards i want "development.log.0.2012-09-24 ", if i execute the above one means the default one also changing.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.