NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

Make the default logging level in production orgs be a more sensible default

Open jongpie opened this issue 1 year ago • 0 comments

Currently, LoggerSettings__c.LoggingLevel__c defaults to 'DEBUG', which makes sense for sandboxes, scratch orgs & dev orgs. But for a few years now, I've been recommending that either 'INFO' or 'WARN' as the value in production orgs for day-to-day monitoring purposes - so Nebula Logger should just... do this automatically.

Right now, the default value for LoggerSettings__c.LoggingLevel__c is configured directly on the field itself, and I don't think there's a way to make the formula smart enough to know if the current org is prod vs not-prod. To get around this, Logger.getUserSettings() and LoggerSettingsController` should be updated so that the default value is dynamically set based on the current org type.

Possible considerations:

  • [ ] What should drive the org type? Organization.IsSandbox?
  • [ ] Should the org-aware default be hardcoded in code? Or configurable via LoggerParameter__mdt records? For example, there could be a CMDT record for ProductionLoggingLevel + record for SandboxLoggingLevel --> Apex code determines org type & reads corresponding CMDT record
  • [ ] Should any other fields on LoggerSettings__c be based on the org type?

jongpie avatar Oct 05 '22 22:10 jongpie