rollbar-gem: Stack trace not displayed when calling Rollbar.error("message")

Doing

Rollbar.error("TLE PDF Attachment => [ERR] Failed to create claim: #{claim.errors.messages}")

produces an item like this: screen shot 2017-02-11 at 11 08 46 pm

Seeing an item like this without a stacktrace gives us many difficulties:

  • I have to search throughout our entire code base for strings like "TLE PDF Attachment => [ERR] Failed to create claim" to see exactly where this is getting raised. This makes it difficult to find it sometimes because we might have similar messages in different places.

  • Some words might be dynamically added. For example, in this case, "{:provider=>["can't be blank"]}" is computed at error time, so we can’t search for that in our code.

  • Sometimes it’s not easy to recognize what parts of the message were computed dynamically and what parts weren’t.

  • If “PDF” was dynamically added, then finding the string would’ve been a pain, because we’d search for “TLE PDF Attachment” and of course we wouldn’t get any results.

To get around this problem we had to create this gem, but I was wondering if there’s any support for this already that we’re not aware of?

Thanks in advance!

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Reactions: 6
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Hi @rivkahstandig3636, is there any way to display the stacktrace of a Rollbar.error(msg) call that we’re not aware of? If not then this is still an issue for us

What do you think about (1) with option to disable/enable backtrace?

# when populate_empty_backtraces = true
Rollbar.error('msg', backtrace: false)
# when populate_empty_backtraces = false
Rollbar.error('msg', backtrace: true)

Also Rollbar.error(Exception.new('test')) appears in Rollbar as Exception: test. It would be great if message appeared without extra prefixes.

Also bumped into this. For now, I’m using something similar to this as a workaround

err = RuntimeError.new(msg)
err.set_backtrace(caller)
Rollbar.error(err, :log_extra => some_extra_data)

(the extra stuff isn’t immediately visible on Rollbar, but you can see it if you click on the occurrence)

I am using Rollbar and have the same problem. I can: A - send logs when app crashes manually and attach custom data which is super helpful B - trust that you will report crash correctly and provide stacktrace but there is no additional data it’s iOS client so symbolication is an issue, I can’t just dump stack trace into txt myself.

So question is: 1 - can I ask for stacktrace to be added to message (and translated to human readable thing) 2 - can I inject some additional data to your crash report

I think the solution here is that we should have an option to include backtraces with messages which is off by default. The implementation being what is in this gem. It is a common enough request.

Hi @santi-h, thanks for opening this issue.

We have a configuration option config.populate_empty_backtraces that popualtes the backtrace for not rescued exception, ex: Rollbar.error(Exception.new(message)). I know this is not the same, but is something. The code for this is https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/item/backtrace.rb#L92-L99.

The logic you have in your gem could reside in https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/item.rb#L187-L193. We’ll think on this and reach you on this issue when we have a conclusion about what to do.

Thanks!

@ArturMoczulski that’s correct, yes, let’s use the same option, imho

Yeah that’s what I understood and I agree, we might as well just have one option.