resque-pool icon indicating copy to clipboard operation
resque-pool copied to clipboard

log writing failed. can't be called from trap context

Open thenashfactor opened this issue 8 years ago • 1 comments

After starting resque-pool via

bundle exec resque-pool --daemon --environment production

resque-pool.stdout.log is populated without issue, but resque-pool.stderr.log complains

log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context 

It's related to logging inside a signal handler--resque and resque-scheduler have migrated to mono_logger to work around this issue.

https://github.com/resque/resque/issues/1493 https://github.com/steveklabnik/mono_logger

Any help would be greatly appreciated, thanks!

thenashfactor avatar Sep 14 '16 21:09 thenashfactor

We are encountering a similar issue.

I found this on the interwebs:

LOG_QUEUE = Queue.new
Thread.start do
  logger = Logger.new(STDOUT)
  nil while logger.info(LOG_QUEUE.pop)
end

Use it like so:

LOG_QUEUE << "my log to STDOUT, works in trap context too"

https://github.com/resque/resque/issues/1493#issuecomment-358711299

Overbryd avatar Jun 22 '20 22:06 Overbryd