qrscu traceback / stack trace not visible in openrem_qr.log

Issue #806 wontfix
Tim de Wit created an issue

qrscu tracebacks seem to be “swallowed” by celery, making debugging hard. It would perhaps be helpful if tracebacks would be added to the openrem_qr.log automatically.

Comments (6)

  1. Tim de Wit reporter

    The above seems to be possible by adding the following code to qrscu.py:

    ...
    
    logger = logging.getLogger('remapp.netdicom.qrscu')  # Explicitly named so that it is still handled when using __main__
    
    from celery import Task
    
    class LogErrorsTask(Task):
        def on_failure(self, exc, task_id, args, kwargs, einfo):
            logger.exception('Failure on Celery task {0}'.format(task_id), exc_info=exc)
            super(LogErrorsTask, self).on_failure(exc, task_id, args, kwargs, einfo)
    

    adding additional argument to the @shared_task decorators:

    @shared_task(name='remapp.netdicom.qrscu.qrscu', base=LogErrorsTask)
    @shared_task(name='remapp.netdicom.qrscu.movescu', base=LogErrorsTask)
    

    Happy to commit these modifications if you think it’s useful… just let me know.

  2. Ed McDonagh

    Cool. I’ll take a look later. Thanks for all your work today!

    Have you got a reference for where you got this method from?

  3. Ed McDonagh

    HI @Tim de Wit - this looks like a sensible thing to do. My only reservation is that I don’t recall being aware that I was missing anything in the current setup!

    Can you put a PR together please?

  4. Log in to comment