How can errors, specific to a given plugin, be logged to an error_log file contained within the plugin root folder itself?
Examples:
- Syntax errors
- Database errors
- Compatibility errors
- PHP fatal errors
- Ajax request errors
Similar to the /wp-content/debug.log file enable when WP_DEBUG_LOG is defined as true in the wp-config.php file (albeit specifically for plugins with its concerns separated from any other general error unrelated to the plugin itself).
Research:
Debugging Plugins section in the official documentation of the Codex refers to using 3rd party plugins to debug 3rd party plugins.
Don’t Develop Without Debuggingby Smashing Magazine refers to site-wide general debugging.
Plugin Handbook appears to layout no specific guidelines.