Logging

2 views
Skip to first unread message

Tim Haines

unread,
Apr 21, 2009, 1:25:14 AM4/21/09
to Rufus Ruby
Hi there,

John - thanks for pointing me to this list.

I'm using Rufus as part of a rails app. I'm using it to run a query
via ActiveRecord every minute. It's causing my log files to fill up
very fast. (not with exceptions, but with normal AR/SQL log entries)

I'm wondering how I'd disable logging for the scheduled tasks, or use
a different log file for them.

Any pointers greatly appreciated.

Cheers,

Tim.

John Mettraux

unread,
Apr 21, 2009, 1:37:39 AM4/21/09
to rufus...@googlegroups.com
On Tue, Apr 21, 2009 at 2:25 PM, Tim Haines <TMHa...@gmail.com> wrote:
>
> I'm using Rufus as part of a rails app.  I'm using it to run a query
> via ActiveRecord every minute.  It's causing my log files to fill up
> very fast.  (not with exceptions, but with normal AR/SQL log entries)
>
> I'm wondering how I'd disable logging for the scheduled tasks, or use
> a different log file for them.
>
> Any pointers greatly appreciated.

Hi Tim,

this isn't really rufus-scheduler related, you should have a look at :

http://groups.google.com/group/rubyonrails-talk
http://groups.google.com/group/rubyonrails-talk/search?q=disable+logging&start=0&scoring=d&

It's probably about manipulation the ActiveRecord::Base.logger which
yields an instance of
http://api.rubyonrails.org/classes/ActiveSupport/BufferedLogger.html

Setting temporarily

ActiveRecord::Base.logger.level = 5

and then back to its previous value should do the trick, but beware of
other operations running [almost] concurrently.


Hope this helps, best regards,

--
John Mettraux - http://jmettraux.wordpress.com

Kenneth Kalmer

unread,
Apr 21, 2009, 5:10:17 AM4/21/09
to rufus...@googlegroups.com
Hi Tim & John

John pointed you exactly to the right spot. The BufferedLogger in ActiveSupport has a #silence method that you try out. I'm not sure how this will affect actions running concurrently though...

Best

--
Kenneth Kalmer
kenneth...@gmail.com
http://opensourcery.co.za
@kennethkalmer

Kenneth Kalmer

unread,
Apr 21, 2009, 5:11:11 AM4/21/09
to rufus...@googlegroups.com
On Tue, Apr 21, 2009 at 7:37 AM, John Mettraux <jmet...@openwfe.org> wrote:
Reply all
Reply to author
Forward
0 new messages