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

Tagging on the Log__c record #106

Closed
CloudJedi opened this issue Mar 16, 2021 · 4 comments · Fixed by #173
Closed

Tagging on the Log__c record #106

CloudJedi opened this issue Mar 16, 2021 · 4 comments · Fixed by #173
Labels
Feature: Tags Items related to Nebula Logger's tagging/labeling functionality Package Type: Managed Package Issues and enhancements that specifically apply to the managed package Type: Question Further information is requested

Comments

@CloudJedi
Copy link

I'm trying to debug a specific apex class and is there a way to easily tag a specific Log__c so that I'll know what it is for?

I noticed the following in the documentation: Assign Topics (Tagging/Labeling System)

I'm actually using the Managed Package to limit the maintenance on client orgs. I'm interested to hear what specific issue is preventing it from being included in the managed package?

@jongpie
Copy link
Owner

jongpie commented Mar 16, 2021

Hey @CloudJedi - there is a bug for the managed package, #90, to hopefully get that issue resolved. Right now, there is code in the unpackaged metadata that will dynamically assign Topics - for some reason, when running as a managed package, the code successfully creates Topic records, but fails to create the TopicAssignment records that would link the topics to Log__c and LogEntry__c records. The same code works completely fine when running outside of a managed package, so it seems to be specific to the managed package.

I'm planning to spend some time on that bug over the next week or two to see if there are any workarounds - I'd really love to get this feature working for the managed package (if possible).

@jongpie jongpie added Feature: Tags Items related to Nebula Logger's tagging/labeling functionality Package Type: Managed Package Issues and enhancements that specifically apply to the managed package Type: Question Further information is requested labels Mar 23, 2021
@jongpie jongpie added this to the Version 4.4.0 milestone Mar 24, 2021
@jongpie jongpie modified the milestones: Version 4.4.0, Version 4.5.0 May 3, 2021
@CloudJedi
Copy link
Author

@jongpie I'm interested to hear any recommendations on the best way to mark a specific log to be related to a specific feature or project so that we can easily filter the logs on the managed package?

@jongpie jongpie modified the milestones: Version 4.5.0, Version 4.6.0 Jun 6, 2021
@jongpie
Copy link
Owner

jongpie commented Jun 15, 2021

@CloudJedi I'm so sorry for the late response! I somehow overlooked the notification about your last comment!

I am still trying to see if it will be possible to get Topics working in the managed package. But one option for your Apex code within the existing managed package version - you can call 1 additional method to provide a stack trace to the logging system - this is something that the unlocked package does automatically, but for the managed package, you have to call an additional method parseStackTrace(String). This will then set the fields Nebula__LogEntry__c.Nebula__OriginLocation__c == your Apex class & method name (e.g., MyClass.myMethod)

// Assuming you're currently calling the logger like this
Nebula.Logger.debug('your log entry message');

// Chain a method call to parseStackTrace with an instance of `DMLException`, which will then populate the OriginLocation__c log entry field
Nebula.Logger.debug('your log entry message').parseStackTrace(new DmlException().getStackTrace());

If that doesn't quite meet your needs, let me know! I'm trying to wrap up some other changes this week, and then I hope to try a few other ideas to see if I can make Topics work correctly within the managed package.

Out of curiosity, would you be able to switch your org to the unlocked package instead of the managed package? You'll get several additional features in the unlocked package, but I'm not sure if your org needs to use the managed package specifically for the namespace.

@jongpie
Copy link
Owner

jongpie commented Aug 10, 2021

@CloudJedi the newest release, v4.6.0, finally provides support for tagging records in the managed package. There's more info in README, but essentially:

  • You can add tags to a LogEntry__c record via Apex, Flow or rules added in the custom metadata type LogEntryTagRule__mdt.
  • The tags are stored in 2 custom objects, LogEntryTag__c and LoggerTag__c - the managed package unfortunately still does not support using Topic and TopicAssignment, but I think the 2 custom objects are a better solution anyway

Let me know if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Tags Items related to Nebula Logger's tagging/labeling functionality Package Type: Managed Package Issues and enhancements that specifically apply to the managed package Type: Question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants