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

Logging method does not work, at all #6

Closed
aelaguiz opened this issue Jan 2, 2014 · 2 comments
Closed

Logging method does not work, at all #6

aelaguiz opened this issue Jan 2, 2014 · 2 comments

Comments

@aelaguiz
Copy link

aelaguiz commented Jan 2, 2014

Sample code:

import sys
import os
import logging
import cratejoy.util.raygun as raygun

log = logging.getLogger(u"cratejoy")

raygun.init_raygun(os.environ.get('RAYGUN_STORE_KEY'))

try:
    log.debug(u"Sup")
except Exception as e:
    print "Caught exception on a regular log statement"
    print e
    sys.exit(1)

try:
    raise Exception(u"wtf")
except Exception as e:
    log.exception(u"error")

The first log statement should NOT except and it should get to the bottom try/catch. It dies at the first one.

(venv)amir-laptop:cratejoy aelaguiz$ foreman run python cratejoy/scripts/error.py
2014-01-02 15:47:04,055 [57104] [DEBUG] error: Sup
<LogRecord: cratejoy, 10, cratejoy/scripts/error.py, 11, "Sup">
Caught exception on a regular log statement
local variable 'exc' referenced before assignment

The code in question in the raygun library:

    def emit(self, record):
        print record
        if record.exc_info:
            exc = record.exc_info

        tags = None
        userCustomData = { "Logger Message" : record.msg }
        request = None
        className = None
        self.sender.send(exc[0], exc[1], exc[2], className, tags, userCustomData, request)

Clearly it will reference exc[0] if no exc_info is attached to a log record. So basically this only works for outputting errors.

@fundead
Copy link
Contributor

fundead commented Jan 6, 2014

Thanks heaps for noticing this. I have pushed a commit which should fix this issue (is working on my end) and am deploying candidate v1.1.3, if you can give this a test and it works this issue can be closed.

Regards,

Callum

@fundead
Copy link
Contributor

fundead commented Jan 25, 2015

This was completed and merged

@fundead fundead closed this as completed Jan 25, 2015
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