NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

Maximum Stack Depth Limit Reached : 1001

Open ihgmpglobant opened this issue 7 months ago • 5 comments

Package Edition of Nebula Logger

Managed Package

Package Version of Nebula Logger

v4.16

New Bug Summary

Hi,

I have a class using a HTTP request and recently started using Nebula Logger, however, when I added a couple of lines to create a log, I started receiving the error of Maximum Stack Depth Limit :1001

I've tried to do in this way:

Nebula.Logger.Info('Transaction Start');

Also tried in this way:

Nebula.LoggerLoggerEntry builder = Nebula.Logger.info('Transaction Start');

And the result was the same, having that maximum stack depth issue.

ihgmpglobant avatar Jun 26 '25 16:06 ihgmpglobant

Hi @ihgmpglobant is there any chance you have a stack trace or any other details that you can share? And/or a sample of your code? Offhand, your use case sounds pretty straight forward, so I'm not sure what could be causing the stack depth limit error.

jongpie avatar Jun 26 '25 20:06 jongpie

HI @jongpie yes basically we are doing this call:

we are doing this HTTP request in a static method called from each

Http http = new Http(); HttpRequest req = new HttpRequest(); String apiEndpoint = endpint; String apiKey = apikey; String apiSecret = apisecret;

    req.setEndpoint(apiEndpoint + '/external/authentication/v1/token');
    req.setMethod('POST');
    req.setHeader('Accept', '*/*');
    req.setHeader('Accept-Encoding', 'gzip, deflate');
    req.setHeader('Authorization', 'Basic ' + EncodingUtil.base64Encode(Blob.valueOf(apiKey + ':' + apiSecret)));
    req.setHeader('Connection', 'keep-alive');
    req.setHeader('Content-Type', 'application/json');
    req.setHeader('cache-control', 'no-cache');
    req.setHeader('Content-Length', '0');
    Nebula.LogEntryEventBuilder builder = Nebula.Logger.Info('start trasnsaction');
    builder.SetHttpRequestDetails(req);
    HttpResponse res = http.send(req);
    builder.setHttpResponseDetails(res);
    Nebula.Logger.saveLog();

we started getting that error in the first Nebula call no matter if I use LogEntryEventBuilder or the simple Nebula.Logger.Info('start transaction)

I hope this detail provides more input.

ihgmpglobant avatar Jul 01 '25 20:07 ihgmpglobant

I tried with Anonymous script from developer console using:

Nebula.Logger.info('test'); Nebula.Logger.saveLog();

thrown the error at the first line.

ihgmpglobant avatar Jul 02 '25 17:07 ihgmpglobant

Hi @ihgmpglobant is there any chance you have a stack trace or any other details that you can share? And/or a sample of your code? Offhand, your use case sounds pretty straight forward, so I'm not sure what could be causing the stack depth limit error.

Hi, I tested in a org with the unmanage package installed and it works as expected.

When I tested in a org with managed package:

Nebula.Logger.info('Information message');
Nebula.Logger.saveLog();

I am getting this:

Line: 3785, Column: 1 System.LimitException: Maximum stack depth reached: 1001

victorramosihg avatar Aug 04 '25 04:08 victorramosihg

@victorramosihg thanks for the details! Do you know which version of the managed package you have installed when that error occurs?

jongpie avatar Aug 04 '25 21:08 jongpie