put record msg and args in history, remove message #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #134.
Python's logging module can throw
UnicodeDecodeError
s when the getMessage function attempts to format the log message. This can happen for a few reasons but it's almost always caused by a mismatch between encodings (ASCII vs UTF-8) and string types (str
vsunicode
) (see #134 for examples). For reference, the source forgetMessage
is as follows:Pyrollbar's log handler stores the last few log records in thread locals to give the user some additional context to their log messages. When building a payload to send to Rollbar, getMessage is called on each record in the history in order to format the record's message.
However, records that cause exceptions when attempting to format can end up stored in pyrollbar's history. Additionally, because of where the exception occurs, the record is never purged from the history. This results in an exception every time a user tries to log because
getMessage
is called on the bad record.We currently don't use the history data in Rollbar's UI other than just displaying it raw. Knowing this, a simple and safe fix is to store the unformatted record message and args instead of the formatted message.