janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Error_log full of entries from the plugin #62

Closed adegans closed 1 year ago

adegans commented 1 year ago

This isn't really necessary is it?

[15-Feb-2023 21:08:01 UTC] [Share on Mastodon] Found the following alt text for the attachment with ID 137317: Header E-Commerce
[15-Feb-2023 21:08:01 UTC] [Share on Mastodon] Here's the `alt` bit of what we're about to send the Mastodon API: `--df4eaaa6445eb5a1860dd96ca34c7b1d
Content-Disposition: form-data; name="description";

These are not errors, and certainly aren't relevant to put in the error_log.

janboddez commented 1 year ago

It's a debug log and they're the only way to get insight in "issues" like #49 or #56. And it only happens during crossposting.

WordPress recommends disabling debug logging in production.

Only way to get rid of this is yet another flag which would have to be enabled together with both WP_DEBUG and WP_DEBUG_LOG, which is going to be even more confusing to users. It's certainly not easy to gather meaningful logging and I'd rather not make it harder.

janboddez commented 1 year ago

On most hosts, when you set those two constants, WP will log errors and notices, etc., and debug statements to ~/public_html/wp-content/debug.log, but on some they'll end up in ~/logs/php or even ~/public_html/error_log, maybe that's where some of the confusion comes from.

adegans commented 1 year ago

But WP_DEBUG is false. So something is going weird then.

janboddez commented 1 year ago

Oh, that is weird.

So, the "normal" behavior is that nothing is ever logged if WP_DEBUG or WP_DEBUG_LOG is false.

But looking at what these constants do, it could be your host is set up to always log everything.

https://github.com/WordPress/WordPress/blob/89a3b0e9f2e1bbaf2315875175c4b2bfa57e08bf/wp-includes/load.php#L4

timnolte commented 1 year ago

@adegans so you have WP_DEBUG set to false or 'false'? https://wordpress.org/documentation/article/debugging-in-wordpress/#wp_debug

adegans commented 1 year ago

Bool. Not a string. Other errors such as fatal errors are logged as well. But all ‘WP stuff’ is off.

So, probably the server does log more than WP wants. And that’s fine it helps me keep track of the occasional issue. But these debug and ‘works as normal’ messages are not necessary for normal operation. Is there a way to turn it off for the plugin?

janboddez commented 1 year ago

I just pushed v0.12.0, also to the WP.org repo, in which debug logging is/can be disabled. Settings > Share on Mastodon > Debugging tab. There, uncheck debug logging and hit "Save Settings."

Let me know if it somehow doesn't work.

adegans commented 1 year ago

Aha! I’ll check it out soon. 🙏