Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Can you capture and store stack trace information in a managed package? This page says that the idea was delivered, but that's not what I'm seeing.

The same code stores this stack trace in the unmanaged version:

 Stack Trace:
    Class.PMT_PaymentCreator.<init>: line 107, column 1
    Class.PMT_Payment_TDTM.run: line 48, column 1
    Class.TDTM_TriggerHandler.runClass: line 118, column 1
    Class.TDTM_TriggerHandler.run: line 68, column 1
    Trigger.TDTM_Opportunity: line 34, column 1

And this one in the managed one:

 Stack Trace:
   (npsp)

I'm using the getStackTraceString method from the Exception class.

share|improve this question
    
It takes a support request to get detailed logging information turned on for a managed package. This is pure speculation, but perhaps this feature also requires enabling by Salesforce support? –  Keith C Apr 3 at 22:13

2 Answers 2

You need to be an ISV and login to the customers org using Subscriber support to see any logging from the managed package, including the stack trace.

See comments on Capturing process information with Apex

share|improve this answer
    
Still testing the issue. A deeper rabbit hole that you'd think. I'll mark your answer as correct as soon as I verify it. We are definitely an ISV (Salesforce.com Foundation), but for now I'm just testing a beta of the new version of our package (the Nonprofit Starter Pack) in a dev org. Got access to the list of Subscribers in the LMA and found the org where I installed the beta. However the package is not listed as one of those belonging to the Foundation...Maybe it's not signed because it's a beta? –  ceiroa Apr 4 at 19:02
    
This does not work in this case, as we are still working with the beta version, which is not identified as being owned by us. Not sure if it will work when we have a production release... –  ceiroa Apr 7 at 18:06
    
I'd previously raised the idea Expose logging from a Beta managed package in the deployed org around this. In @ca_peterson's answer he reports that beta packages work with the subscribers tab, but I've never had the chance to try it. –  Daniel Ballinger Apr 7 at 19:25
    
I just commented below. Subscribers tab did not work for me on beta package... –  ceiroa Apr 7 at 20:51

In addition to the ISV subscribers console method posted by Daniel backline support is technically able to "unmask debug logs" for a managed namespace temporarily which will expose this info. You'll need consent from the package author (if it's not you) to make this happen.

share|improve this answer
    
This is good to know. This would be a partial solution to Ideas: Expose logging from a Beta managed package in the deployed org –  Daniel Ballinger Apr 4 at 1:33
    
The subscribers tab worked on beta packages last I checked. By far the best solution to that idea imo –  ca_peterson Apr 4 at 1:47
    
Ah, OK. Thinks may have moved on in the 2 years since that Idea was raised. –  Daniel Ballinger Apr 4 at 1:51
    
Any idea if this works for error information already stored? We have implemented error handling in our package that will store error information in the database. I'd be great if the "masking" of stack traces happened at runtime. That is, that the stack trace was stored regardless, but that it's shown only if the unmasking of debug logs is enabled. –  ceiroa Apr 4 at 19:29
    
@ceiroa no way of enabling this retroactively that I know of. However unhandled exceptions (that make it to the top of the stack) do get the stack trace emailed to the package author (although this doesn't work for sandboxes for some reason) –  ca_peterson Apr 4 at 19:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.