Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thenashfactor opened this issue Sep 14, 2016 · 1 comment
Open

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

thenashfactor opened this issue Sep 14, 2016 · 1 comment

Comments

@thenashfactor
Copy link

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.

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

Any help would be greatly appreciated, thanks!

@Overbryd
Copy link
Contributor

Overbryd commented Jun 22, 2020

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"

resque/resque#1493 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants