Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent python google functions logs from splitting in multiple lines

When I moved to python 3.11 with my Google functions, logs started to be splitted in multiple lines. For example if function result in error, Traceback is splitted in many lines which makes it really hard to debug. Example in the screenshot below.

Previously I deployed functions in python 3.7 and Traceback errors where all in one log entry

How to prevent that?

enter image description here

like image 878
M.wol Avatar asked Sep 16 '25 05:09

M.wol


1 Answers

It's because of Fine-grained error locations in tracebacks, which is actually a really cool feature of python 3.11. I'm assuming GCP's logging just doesn't handle this at the moment.

As a quick fix, you can disable this by setting this environment variable: PYTHONNODEBUGRANGES=0, which should make the error messages look normal.

like image 71
Flobbinhood Avatar answered Sep 18 '25 19:09

Flobbinhood