-
-
Notifications
You must be signed in to change notification settings - Fork 228
Closed
Labels
Layer: ConfigurationItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeLayer: Logger EngineItems related to the core logging engineItems related to the core logging engineType: BugSomething isn't workingSomething isn't working
Milestone
Description
Since LoggerSettings__c is a custom setting, it is not automatically available with any pre-configured org defaults without using the @IsTest(SeeAllData=true) annotation.
@IsTest
static void Nebula_Harness() {
// outputs using the in-code default format (creates its own LoggerSettings__c)
Logger.debug( 'Pre-LoggerSettings Update' );
LoggerSettings__c settings = Logger.getUserSettings();
settings.SystemLogMessageFormat__c = '{OriginLocation__c} -- {Message__c}';
// outputs using the updated format (above)
Logger.debug( 'Post-LoggerSettings Update' );
}
@IsTest
static void Nebula_WithDefined() {
LoggerSettings__c orgDefaults = LoggerSettings__c.getOrgDefaults();
orgDefaults.SystemLogMessageFormat__c = '{OriginLocation__c} -- {Message__c}';
upsert orgDefaults;
// outputs using the updated format (above)
Logger.debug( 'Logging with custom system message format set in org default settings' );
}
The result is a different logger format for real debug logs vs. apex test debug logs.
Workarounds include creating this in every test class (in a @TestSetup method, maybe?)... or just living with the default log format.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Layer: ConfigurationItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeLayer: Logger EngineItems related to the core logging engineItems related to the core logging engineType: BugSomething isn't workingSomething isn't working