python-client icon indicating copy to clipboard operation
python-client copied to clipboard

Changing log level on api errors

Open gtal-box opened this issue 1 year ago • 3 comments

Currently when there is an api error the logger logs and error, but the stack trace is included only in a following debug log. This is true to all api clients, including segments, splits, events, impressions, telemetry for example: https://github.com/splitio/python-client/blob/832613875cf1d5de0cfd6119ab358badc45d9cac/splitio/api/segments.py#L69

What is the reason for this? And is it possible to turn this into one error message with the stack trace included?

gtal-box avatar Mar 13 '24 11:03 gtal-box

Hi @gtal-box - the reason for this is that Error and Debug are two different log levels. At the error level you will just get the error. The debug log level you will get both the error and the stack trace.

kleinjoshuaa avatar Mar 28 '24 21:03 kleinjoshuaa

Hi @kleinjoshuaa,

From my humble experience it is a common practice to have the stack trace as part of the error log message.

  1. I see you are already doing it in other client libraries like dotnet and java.
  2. It is easier to investigate prod problems without turning debug logs on.

Can you please consider adding the stack trace to the error message?

gtal-box avatar Apr 02 '24 08:04 gtal-box