librelist archives

« back to archive

resque log to a file

resque log to a file

From:
Mick Staugaard
Date:
2010-04-01 @ 19:05
I'm sure the root of this problem is not in resque, but anyway...

When running running a worker with logging enabled I get both the log 
entries from the parent and the children in my console:

*** Starting worker Bianca.local:2849:*
** [12:02:21 2010-04-01] 2849: Registered signals
** [12:02:21 2010-04-01] 2849: Running before_first_fork hook
** [12:02:22 2010-04-01] 2849: Checking jobs
** [12:02:22 2010-04-01] 2849: Checking rule_count_job_queue
** [12:02:22 2010-04-01] 2849: Found job on rule_count_job_queue
** [12:02:22 2010-04-01] 2849: got: (Job{rule_count_job_queue} | 
RuleTicketCountJob | [1, 1])
** [12:02:22 2010-04-01] 2849: Running before_fork hook
** [12:02:22 2010-04-01] 2849: resque-1.6.0: Forked 2851 at 1270148542
** [12:02:22 2010-04-01] 2851: resque-1.6.0: Processing 
rule_count_job_queue since 1270148542
** [12:02:22 2010-04-01] 2851: done: (Job{rule_count_job_queue} | 
RuleTicketCountJob | [1, 1])
** [12:02:22 2010-04-01] 2851: Running before_child_exit hook with 
[#<Worker Bianca.local:2849:*>]
** [12:02:22 2010-04-01] 2851: this fork performed 1 jobs
** [12:02:22 2010-04-01] 2849: Checking jobs
** [12:02:22 2010-04-01] 2849: Checking rule_count_job_queue
** [12:02:22 2010-04-01] 2849: Sleeping for 5


but when I pipe stdout to a file ( with > tmp.log ), I only get the log 
entries for the parent process in the file:

*** Starting worker Bianca.local:2838:*
** [11:58:35 2010-04-01] 2838: Registered signals
** [11:58:35 2010-04-01] 2838: Running before_first_fork hook
** [11:59:17 2010-04-01] 2838: Checking jobs
** [11:59:17 2010-04-01] 2838: Checking rule_count_job_queue
** [11:59:17 2010-04-01] 2838: Found job on rule_count_job_queue
** [11:59:17 2010-04-01] 2838: got: (Job{rule_count_job_queue} | 
RuleTicketCountJob | [1, 1])
** [11:59:17 2010-04-01] 2838: Running before_fork hook
** [11:59:17 2010-04-01] 2838: resque-1.6.0: Forked 2841 at 1270148357
** [11:59:17 2010-04-01] 2838: Checking jobs
** [11:59:17 2010-04-01] 2838: Checking rule_count_job_queue
** [11:59:17 2010-04-01] 2838: Sleeping for 5


How do I get the whole thing in the file?

Thanks,
Mick

Re: [resque] resque log to a file

From:
Luke Antins
Date:
2010-04-01 @ 20:58
Mick Staugaard wrote:
> I'm sure the root of this problem is not in resque, but anyway...
>
> When running running a worker with logging enabled I get both the log 
> entries from the parent and the children in my console:
> but when I pipe stdout to a file ( with > tmp.log ), I only get the 
> log entries for the parent process in the file:
>
> How do I get the whole thing in the file?
I've tried the same thing here on OS X and getting the same results as you.
AFAIK when you fork, STDOUT and STDERR should be the same in parent and 
child.

I've been digging about, but not managed sussed! No-doubt it's really 
simple =)

Luke

Re: [resque] resque log to a file

From:
Chris Wanstrath
Date:
2010-04-02 @ 22:49
On Thu, Apr 1, 2010 at 12:05 PM, Mick Staugaard <mick@zendesk.com> wrote:

> How do I get the whole thing in the file?

http://github.com/defunkt/resque/commit/0337b6bce09a7a1a80f7c5a883e31a139e45af47

Just released 1.7.1 with this fix. Sorry about that.

-- 
Chris Wanstrath
http://github.com/defunkt

Re: [resque] resque log to a file

From:
Mick Staugaard
Date:
2010-04-05 @ 16:20
thanks Chris.


On Apr 2, 2010, at 3:49 PM, Chris Wanstrath wrote:

> On Thu, Apr 1, 2010 at 12:05 PM, Mick Staugaard <mick@zendesk.com> wrote:
> 
>> How do I get the whole thing in the file?
> 
> http://github.com/defunkt/resque/commit/0337b6bce09a7a1a80f7c5a883e31a139e45af47
> 
> Just released 1.7.1 with this fix. Sorry about that.
> 
> -- 
> Chris Wanstrath
> http://github.com/defunkt

Re: [resque] resque log to a file

From:
Luke Antins
Date:
2010-04-03 @ 03:29
Chris Wanstrath wrote:
> http://github.com/defunkt/resque/commit/0337b6bce09a7a1a80f7c5a883e31a139e45af47
> Just released 1.7.1 with this fix. Sorry about that.
>
>    
Confirmed working for me Chris, thank you!
I did come across some code that used #sync on STDOUT durring my 
hunting, but everything I seen just referred to ensuring the order of 
the log files... so I never bothered trying...
Thank you again! =)

Luke