2011-12-07 51 views
1

セロリのタスクからdjango-sentryにエラーを記録するにはどうすればよいですか?以外:セロリのdjango-sentryへのログのエラー

は、私が試してみましたブロックとraven_client.create_from_exceptionを使用しますが、それはと毎回吹く:

Traceback (most recent call last): 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/celery/execute/trace.py", line 47, in trace 
     return cls(states.SUCCESS, retval=fun(*args, **kwargs)) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/celery/app/task/__init__.py", line 247, in __call__ 
     return self.run(*args, **kwargs) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/celery/app/__init__.py", line 175, in run 
     return fun(*args, **kwargs) 
     File "/home/controlpanel/deployments/1323265958/src/deploy/tasks.py", line 60, in async_deploy_bundle 
     raven_client.create_from_exception(exc_info=exc_info) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/contrib/django/__init__.py", line 120, in create_from_exception 
     return super(DjangoClient, self).create_from_exception(exc_info, **kwargs) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/base.py", line 285, in create_from_exception 
     frames = varmap(shorten, get_stack_info(iter_traceback_frames(exc_traceback))) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/stacks.py", line 128, in get_stack_info 
     'vars': transform(frame.f_locals.items()), 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 78, in transform 
     ret = type(value)(transform_rec(o) for o in value) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 78, in <genexpr> 
     ret = type(value)(transform_rec(o) for o in value) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 72, in <lambda> 
     transform_rec = lambda o: transform(o, stack + [value], context) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 78, in transform 
     ret = type(value)(transform_rec(o) for o in value) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 78, in <genexpr> 
     ret = type(value)(transform_rec(o) for o in value) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 72, in <lambda> 
     transform_rec = lambda o: transform(o, stack + [value], context) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/raven/utils/encoding.py", line 78, in transform 
     ret = type(value)(transform_rec(o) for o in value) 
     File "/home/controlpanel/current/env/lib/python2.6/site-packages/git/util.py", line 588, in __init__ 
     raise ValueError("First parameter must be a string identifying the name-property. Extend the list after initialization") 
    ValueError: First parameter must be a string identifying the name-property. Extend the list after initialization 

マイタスク:

@task 
def async_deploy_bundle(bundle_id): 
    try: 
     do_stuff(bundle_id) 
    except: 
     exc_info = sys.exc_info() 
     traceback.print_exception(*exc_info) 
     try: 
      raven_client = get_client() 
      raven_client.create_from_exception(exc_info=exc_info) 
     except: 
      pass 
     raise 
+0

あなたは 'create_from_exception'を呼び出している行を投稿できますか? –

+0

質問に自分の仕事を追加しました – ojii

答えて

2

これは何について:

myLogger = logging.getLogger('mylogger.info') 
    myLogger.setLevel(logging.INFO) 
    myLogger.info(exc_info) 

?私のsettings.pyで

'loggers': { 
    'mylogger.info': { 
     'level': 'INFO', 
     'handlers': ['sentry'], 
     'propagate': False, 
     }, 
      }