You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This macro expands correctly, but the problem is that when uwsgi_error() is used under functions that are cross-refrenced, mainly in utils.c, uwsgi_error() takes the filename of the file where the function including it resides in, instead of where that function is called.
Example: uwsgi_malloc() is defined in utils.c, and calls uwsgi_error() if it can't allocate space. No matter where you call uwsgi_malloc, if an error happens - the filename that will be logged will always be 'utils.c' instead of where uwsgi_malloc() was originally called (say in some plugin)!
I have started writing a shell script that will:
change uwsgi_error() definition, and respective definitions of functions that include it, and parents of these functions, to pass filename and line from the original call that will pass __FILE__ and __LINE__.
That way uwsgi will always log the correct line and file that caused the issue!
This will introduce changes all throughout the project.
I think I will get around to it in a few days, If someone else has a better implementation for it, or is faster than me I'm therefore sharing this issue.
The text was updated successfully, but these errors were encountered:
A problem with how uwsgi logs error messages, and therefore makes it harder to debug problems:
#define uwsgi_error(x) uwsgi_log("%s: %s [%s line %d]\n", x, strerror(errno), __FILE__, __LINE__);
This macro expands correctly, but the problem is that when
uwsgi_error()
is used under functions that are cross-refrenced, mainly in utils.c,uwsgi_error()
takes the filename of the file where the function including it resides in, instead of where that function is called.Example:
uwsgi_malloc()
is defined in utils.c, and callsuwsgi_error()
if it can't allocate space. No matter where you calluwsgi_malloc
, if an error happens - the filename that will be logged will always be 'utils.c' instead of whereuwsgi_malloc()
was originally called (say in some plugin)!I have started writing a shell script that will:
change
uwsgi_error()
definition, and respective definitions of functions that include it, and parents of these functions, to passfilename
andline
from the original call that will pass__FILE__
and__LINE__
.That way uwsgi will always log the correct line and file that caused the issue!
This will introduce changes all throughout the project.
I think I will get around to it in a few days, If someone else has a better implementation for it, or is faster than me I'm therefore sharing this issue.
The text was updated successfully, but these errors were encountered: