Skip to content

Commit 4fbfaa8

Browse files
authored
Origin Location Parsing Improvement (#872)
* Slight tweak to origin location stack trace parsing in Apex to improve how origin location is displayed
1 parent 0642147 commit 4fbfaa8

File tree

8 files changed

+44
-11
lines changed

8 files changed

+44
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, OmniStudio, and integrations.
77

8-
## Unlocked Package - v4.16.1
8+
## Unlocked Package - v4.16.2
99

10-
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04tKe0000011MXEIA2)
11-
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tKe0000011MXEIA2)
10+
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04tKe0000011Mi9IAE)
11+
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tKe0000011Mi9IAE)
1212
[![View Documentation](./images/btn-view-documentation.png)](https://github.com/jongpie/NebulaLogger/wiki)
1313

14-
`sf package install --wait 20 --security-type AdminsOnly --package 04tKe0000011MXEIA2`
14+
`sf package install --wait 20 --security-type AdminsOnly --package 04tKe0000011Mi9IAE`
1515

1616
---
1717

nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ global with sharing class LogEntryEventBuilder {
510510
* @return The same instance of `LogEntryEventBuilder`, useful for chaining methods
511511
*/
512512
global LogEntryEventBuilder setRecord(Map<Id, SObject> recordIdToRecord) {
513-
if (this.shouldSave == false) {
513+
if (this.shouldSave() == false) {
514514
return this;
515515
}
516516

nebula-logger/core/main/logger-engine/classes/Logger.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
global with sharing class Logger {
1616
// There's no reliable way to get the version number dynamically in Apex
1717
@TestVisible
18-
private static final String CURRENT_VERSION_NUMBER = 'v4.16.1';
18+
private static final String CURRENT_VERSION_NUMBER = 'v4.16.2';
1919
private static final System.LoggingLevel FALLBACK_LOGGING_LEVEL = System.LoggingLevel.DEBUG;
2020
private static final List<LogEntryEventBuilder> LOG_ENTRIES_BUFFER = new List<LogEntryEventBuilder>();
2121
private static final String MISSING_SCENARIO_ERROR_MESSAGE = 'No logger scenario specified. A scenario is required for logging in this org.';

nebula-logger/core/main/logger-engine/classes/LoggerStackTrace.cls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public without sharing class LoggerStackTrace {
134134
}
135135

136136
String firstStackTraceLine = cleansedStackTraceLines.get(0);
137+
if (firstStackTraceLine == 'External entry point' && cleansedStackTraceLines.size() > 1) {
138+
firstStackTraceLine = cleansedStackTraceLines.get(1);
139+
}
140+
137141
String cleanedLocation = firstStackTraceLine;
138142
if (cleanedLocation.contains(':')) {
139143
cleanedLocation = cleanedLocation.substringBefore(':');

nebula-logger/core/main/logger-engine/lwc/logger/loggerService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import LoggerServiceTaskQueue from './loggerServiceTaskQueue';
1010
import getSettings from '@salesforce/apex/ComponentLogger.getSettings';
1111
import saveComponentLogEntries from '@salesforce/apex/ComponentLogger.saveComponentLogEntries';
1212

13-
const CURRENT_VERSION_NUMBER = 'v4.16.1';
13+
const CURRENT_VERSION_NUMBER = 'v4.16.2';
1414

1515
const CONSOLE_OUTPUT_CONFIG = {
1616
messagePrefix: `%c Nebula Logger ${CURRENT_VERSION_NUMBER} `,

nebula-logger/core/tests/logger-engine/classes/LoggerStackTrace_Tests.cls

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,34 @@ private class LoggerStackTrace_Tests {
237237
System.Assert.isNull(stackTrace.Source);
238238
}
239239

240+
@IsTest
241+
static void it_should_ignore_external_entry_point_stack_trace_line() {
242+
String externalEntryPointStackTrace = 'External entry point';
243+
String mockStackTrace = externalEntryPointStackTrace + '\n' + 'Class.SomeClass.someMethod: line 1, column 1';
244+
245+
LoggerStackTrace stackTrace = new LoggerStackTrace(mockStackTrace);
246+
247+
System.Assert.areEqual(LoggerStackTrace.SourceLanguage.Apex, stackTrace.Language);
248+
System.Assert.areEqual('SomeClass.someMethod', stackTrace.Location);
249+
System.Assert.areEqual(mockStackTrace, stackTrace.ParsedStackTraceString);
250+
}
251+
252+
@IsTest
253+
static void it_should_not_skip_external_entry_point_stack_trace_line_in_middle_of_stack_trace() {
254+
String externalEntryPointStackTrace = 'External entry point';
255+
String mockStackTrace =
256+
'Class.SomeClass.someMethod: line 1, column 1' +
257+
'\n' +
258+
externalEntryPointStackTrace +
259+
'Class.SomeOtherClass.someMethod: line 1, column 1';
260+
261+
LoggerStackTrace stackTrace = new LoggerStackTrace(mockStackTrace);
262+
263+
System.Assert.areEqual(LoggerStackTrace.SourceLanguage.Apex, stackTrace.Language);
264+
System.Assert.areEqual('SomeClass.someMethod', stackTrace.Location);
265+
System.Assert.isTrue(stackTrace.ParsedStackTraceString.contains(externalEntryPointStackTrace));
266+
}
267+
240268
private class DebugStringExample {
241269
private System.Exception constructorStackTraceGenerator;
242270
private System.Exception methodStackTraceGenerator;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nebula-logger",
3-
"version": "4.16.1",
3+
"version": "4.16.2",
44
"description": "The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.",
55
"author": "Jonathan Gillespie",
66
"license": "MIT",

sfdx-project.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"path": "./nebula-logger/core",
1010
"definitionFile": "./config/scratch-orgs/base-scratch-def.json",
1111
"scopeProfiles": true,
12-
"versionNumber": "4.16.1.NEXT",
13-
"versionName": "Data Masking & String Truncation Improvements",
14-
"versionDescription": "Fixed several issues with the included data masking rules in LogEntryDataMaskRule__mdt, added several new *Truncation__c fields (like LogEntry__c.HttpRequestBodyTruncated__c & LogEntry__c.HttpResponseBodyTruncated__c), and fixed issues with string truncation to ensure the value is properly truncated after data masking has occurred.",
12+
"versionNumber": "4.16.2.NEXT",
13+
"versionName": "Origin Location Parsing Improvements",
14+
"versionDescription": "Tweaked how origin location is parsed when External entry point is the first line of a stack trace",
1515
"postInstallUrl": "https://github.com/jongpie/NebulaLogger/wiki",
1616
"releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases",
1717
"unpackagedMetadata": {
@@ -217,6 +217,7 @@
217217
"Nebula Logger - Core@4.15.10-approval-logging": "04t5Y0000015pGeQAI",
218218
"Nebula Logger - Core@4.16.0-spring-'25-release": "04t5Y0000015pGyQAI",
219219
"Nebula Logger - Core@4.16.1-data-masking-&-string-truncation-improvements": "04tKe0000011MXEIA2",
220+
"Nebula Logger - Core@4.16.2-origin-location-parsing-improvements": "04tKe0000011Mi9IAE",
220221
"Nebula Logger - Core Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI",
221222
"Nebula Logger - Core Plugin - Async Failure Additions@1.0.0": "04t5Y0000015lhiQAA",
222223
"Nebula Logger - Core Plugin - Async Failure Additions@1.0.1": "04t5Y0000015lhsQAA",

0 commit comments

Comments
 (0)