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

Toggle to not save logs to the object and write to Apex Debug logs #258

Closed
anandbn opened this issue Jan 5, 2022 · 3 comments · Fixed by #274
Closed

Toggle to not save logs to the object and write to Apex Debug logs #258

anandbn opened this issue Jan 5, 2022 · 3 comments · Fixed by #274
Labels
Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Logger Engine Items related to the core logging engine Type: Enhancement New feature or request

Comments

@anandbn
Copy link

anandbn commented Jan 5, 2022

New Feature Summary

Add a LoggerSettings to turn on / off the saving of logs to logging custom objects. When turned off, it should write the log to Apex debug log instead so that we can use the standard debug log view to view the logged info.

@anandbn anandbn added the Type: Enhancement New feature or request label Jan 5, 2022
@jongpie
Copy link
Owner

jongpie commented Jan 5, 2022

Hi @anandbn - thanks for the suggestion! I think this is a great idea - we're also looking into adding support for logging to a BigObject (see #117), so I think we'll try to bundle this enhancement together so that there's more control overall of where data is logged.

I'm not sure exactly when we'll get this implemented, but I'll keep you updated on the progress!

@jongpie jongpie added Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Logger Engine Items related to the core logging engine labels Jan 5, 2022
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
jongpie added a commit that referenced this issue Jan 24, 2022
…ed__c and IsPlatformEventStorageEnabled__c), and further enhanced the refactor that @jamessimone helped with for loggerSettings - I've added another JS file, loggerSettingsPageLayout, to make it easier to manage/update the faux page layout via updating a JSON object (instead of updating/duplicating HTML)

Also cleaned up help text in several fields
@jongpie
Copy link
Owner

jongpie commented Jan 24, 2022

Hey @anandbn - I was able to implement this as part of the next release, v4.7.0 (PR #274). I'm planning to release this in about 2 weeks, once all orgs have been upgraded to Spring '22 release (which should happen on February 12). The PR includes 2 new fields that provide control over creation of platform event and custom object records:

  1. IsSavingEnabled__c - when disabled, any calls to Logger.saveLog() are ignored. This allows you to still use Logger for output Apex debug statements, but completely disable saving/publishing of the platform event LogEntryEvent__e.
  2. IsPlatformEventStorageEnabled__c - this fields controls if LogEntryEvent__e platform events are transformed & stored in the custom objects Log__c and LogEntry__c (when IsSavingEnabled__c == true).

image

jongpie added a commit that referenced this issue Mar 11, 2022
[LoggerSettings__c changes]

* Closed #279 by adding a new settings field DefaultLogScenario__c and new method Logger.getScenario()

* Closed #258 by adding 2 new fields to LoggerSettings__c (IsSavingEnabled__c and IsPlatformEventStorageEnabled__c)

* Cleaned up help text in several LoggerSettings__c fields

* Added new field LoggerSettings__c.DefaultLogOwner__c that can be used to specify a default owner of Log__c records, using a user ID, username, queue ID or queue developer name

* Renamed LoggerSettings__c field StripInaccessibleRecordFields__c to IsRecordFieldStrippingEnabled__c for consistency



[Log__c UI changes]

* Renamed "View JSON" quickAction to "Open Viewer", and added tabs within logViewer lwc to provide views for both JSON (existing) and log file (new) - a new 'download' button now allows exporting the content to a file

  - For the unlocked package, the logJSON lwc was renamed back to logViewer

* Fixed a conditional render rule on LogEntryRecordpage.flexipage, added an extra check in parseStackTrace() method to handle some problematic lines within a string that is otherwise valid, removed namespace filter when querying ApexClass in LogEntryHandler

* Added picklist values for API Versions in calendar year 2022



[Managed Package changes]

* Changed visibility of LoggerParameter__mdt object from 'Protected' to 'Public'

* Made most LoggerParameter__mdt records non-protected so they can be updated in the managed package

* Worked with @jamessimone to implement a custom approach for dynamically retrieving objects & fields (including namespace) in loggerSettings and logEntryEventStream LWCs, using the new Apex class LoggerSObjectMetadata

  - LWC does not officially support platform events, custom settings, or custom metadata types, so LoggerSObjectMetadata will be used instead

* Re-added skeleton of the deprecated quick action ViewJSON and aura cmp logJSONViewer for the managed package



[Bugfixes]

* Fixed #272 by explicitly delcaring the list as List<Schema.PicklistEntry> instead of just List<PicklistEntry>



[Improvements for Tests & Utilities]

* Added calls to Test.getEventBus().deliver() in Flow classes to try to resolve some inconsistent test failures in the pipeline

* Standardized calls to Database.query() to also use String.escapeSingleQuotes()

* Fixed #276 - Added a check in LoggerEmailUtils to check if email deliverability is enabled before sending an email [skip ci]

* Refactored some code in LogHandler, removed exclusion of PMD rule 'AvoidGlobalModifier'

* Added missing test in LogEntryTagHandler_Tests for updating records

* Fixed some test asserts for 'DUPLICATE_VALUE' error that didn't work correctly when the user's language was not English

* Updated LoggerTestUtils test method to create its own test user, instead of trying to update the current user's record

## Pipeline & Packaging

* Bumped package version to v4.7.0, added devDependencies for outdated packages reported by dependabot in GitHub

* Closed #263 by adding new keyword "ancestorVersion": "HIGHEST" in both sfdx-project.json files

* Updated mgd pkg creation script to use --codecoverage instead of --skipvalidation

* Updated codecov.yml so PR comments are deleted & readded, instead of updated

* Fixed error handling of package creation & installation in pwsh scripts

* Temporarily disabling pipeline check for updated docs due to an error in apexdocs package

* Switched to using JWT bearer flow in pipeline for dev hub auth

* Upgraded sfdx-cli, cleaned up package.json, cleaned up both sfdx-project.json files

* Removed local linking of sfdx-scanner in npm prepare script, added linking command to build.yml, added new sfdx plugin for prettier

* Moved scripts folder back to being a top-level folder

* Switched to using new packageAlias sorting feature in bummer sfdx plugin

* Switched from using sfdx force:community:create + a delay in the pipeline, to instead deploying metadata for a skeleton Experience Cloud site
  The pipeline has been having inconsistent failures because it previously had a 2 minute delay added to wait for force:community:create, but sometimes it took Salesforce longer to finish creating the site asynchronously. Using a deploy will make it a synchronous operation, so it should prevent the inconsistent failures.

Co-authored-by: James Simone <[email protected]>
@jongpie
Copy link
Owner

jongpie commented Mar 11, 2022

@anandbn this feature has finally been released! It's available in v4.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Logger Engine Items related to the core logging engine Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants