6

Should you need a custom logging class for your managed package? I'm aware that you can use subscriber support but is there any benefit of using custom logging?

If you do implement a custom logger, what is the visibility on the Logger custom object? Since the custom object would consist of application specific logs, can you limit access to the data (error messages) in the Logger custom object in the subscriber org?

4

If you can, it's much better to use the License Management App application to access the debug logs from a managed package installed in a client org.

You'll find limited usage for a custom object logger, as even dumping the stack trace will be obscured to just the namespace in the subscriber org.

| improve this answer | |
3

Should you need a custom logging class for your managed package?

Generally speaking, no. Some ISVs do decide to do this to avoid the complications of subscriber logging (you have to submit a case, etc), and the default Apex Error Notification system tends to work well enough, but if you feel it's inadequate, you certainly could build your own.

I'm aware that you can use subscriber support but is there any benefit of using custom logging?

If the built-in notification system and subscriber logging features just doesn't cut it, you might benefit from custom logging. I haven't run in to a situation where the out-of-the-box features couldn't handle it, but on the other hand, I've only been an employee at one ISV, so it's an underwhelming sample size. I hope that someone will edit/add info about a specific situation that's hard to debug using only the standard tools.

If you do implement a custom logger, what is the visibility on the Logger custom object?

It's whatever the admin wants it to be. There's no way to restrict visibility of an object once installed, except for Custom Settings, so these logs could potentially be visible to everyone in the org.

Since the custom object would consist of application specific logs, can you limit access to the data (error messages) in the Logger custom object in the subscriber org?

No, but if you really wanted to, you could ship or generate a private encryption key protected by some mechanism, so that even if the users can view the records, all they will see is encrypted "junk" that they can't view. This would make use of the standard Crypto class. If you need to have "secret" data, you can use encryption.

Overall, the default logging is protected, and fairly easy to use. There is rarely any design that would benefit from custom logging.

| improve this answer | |
  • The only time I have needed it was when integrating with another package API. I know there was an error but did not know which method as was calling 8 or 9 to setup and use their API. I threw some code before every method I called to build up a custom hard coded stack trace and then output that trace as the error. It got me to the offending third party method but that was it....Otherwise you are spot on. – Eric Mar 27 '17 at 20:39
2

You cannot limit access to the object aside from the local standard OWD and sharing settings.

And even at that logging will be limited to your specific text. Any errors logged via getMessage, getStacktraceString, or other apex methods would be obfuscated when written to the DB so it is not helpful.

LMA is best for real time debugging

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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