Is it possible to store the log file by day?

I hope to store the log file by day , because the log file will be so
large
with the time goes by.Is it possible to do this ?

On 20 October 2012 14:28, leo108 [email protected] wrote:

I hope to store the log file by day , because the log file will be so large
with the time goes by.Is it possible to do this ?

You could provide a daily cron task, something like
cd /path/to/application && RAILS_ENV=production rake log:clear
or without the rails_env if it is the development log that you are
interested in.

Colin

On Sat, Oct 20, 2012 at 8:28 AM, leo108 [email protected] wrote:

I hope to store the log file by day , because the log file will be so
large with the time goes by.Is it possible to do this ?

I am curious which log library you are using.

From the standard library it is clear you can do this easily, if you are
concerned about size or date:

http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new

On Sun, Oct 21, 2012 at 7:32 AM, Colin L. [email protected]
wrote:

From the standard library it is clear you can do this easily, if you are
concerned about size or date:

http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new

I guess he is using the standard rails logger. How would one apply
this to the standard logger, I can’t see in my code where it is
created.

Colin

Can you use logrotate or whatever the OS gives for rotating logs?

On 21 October 2012 12:09, Victor G. [email protected] wrote:

concerned about size or date:

http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new

I guess he is using the standard rails logger. How would one apply
this to the standard logger, I can’t see in my code where it is
created.

Colin

On Sun, Oct 21, 2012 at 5:29 PM, Victor G. [email protected]
wrote:

Can you use logrotate or whatever the OS gives for rotating logs?

Yes I agree you should be using logrotate because most logging in
applications is not rotated by them, but instead by logrotate, this
way you can easily adjust the time between your logging, for example I
rotate all my logs hourly some people do it daily, some monthly. If
this were to happen in every application it would become a pretty
annoying task imo.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs