Topic: How to stop writing to Log or Restrict the Log file size?

Hi,

The development log file keeps on growing. How to restrict the data writing to the log file?
Or is there any method to fix the log file size?

Thanks in advance

Re: How to stop writing to Log or Restrict the Log file size?

Once you are done with sections of the development.log file you can empty it. Do that by selecting all in your editor and deleting the contents or by

cat /dev/null > development.log

Re: How to stop writing to Log or Restrict the Log file size?

A better, less manual way, is to use the log configuration options and turn log rotation on.

The short version is that you'll set config.logger to a new logger (instead of letting rails use its defaults) and when you declare that new logger you can turn on rotation and size limits.

See: http://wiki.rubyonrails.org/rails/pages … ureLogging

Re: How to stop writing to Log or Restrict the Log file size?

I thought of logrotate, seems like overkill for a local dev log to me, on a server however you should always roll your logs so you can keep them and keep them a manageable size.

Re: How to stop writing to Log or Restrict the Log file size?

cherring wrote:

I thought of logrotate, seems like overkill for a local dev log to me, on a server however you should always roll your logs so you can keep them and keep them a manageable size.

Yes but logrotate does it for you, having to manually do the cat /dev/null trick or run rake log:clear is just one more manual process. Let the computer do what it does best and automate the simple manual tasks as much as possible.