We have already discussed error_log here.
The current_filter() function will return the current WordPress filter or action calling a specific function. The return type is string, so it’s straight forward to just use it.
Add the following inside the function to know which WordPress action or filter is calling it.
error_log( "\n Current action / filter = " . current_filter(), 3, ABSPATH . "/my_error_log.log" );
Another PHP tool is debug_backtrace().
error_log( "\n " . print_r( debug_backtrace( true, 2 ), true ), 3, ABSPATH . "/my_error_log.log" );