fahadmahmood8 / stock-locations-for-woocommerce

This plugin will help you manage WooCommerce Products stocks through locations and also different traditional barcodes.
https://pt.wordpress.org/plugins/stock-locations-for-woocommerce/
GNU General Public License v3.0
22 stars 14 forks source link

Logs larger then max_allowed_packet - Log toggle #159

Closed AntOnKneess closed 3 weeks ago

AntOnKneess commented 2 months ago

The logging feature in this plugin writes all logs to the same row of the wp_options table, for websites with many products and many quantity updates this leads to a very large row and eventually an error, the full error message is 4gb long:

Got a packet bigger than 'max_allowed_packet' bytes for query UPDATE wp_options SET option_value = 'a:80449:{i:0;s:188:\"$postId: 87601, $parentPostId: 87601 (product_update_callback / update_additional_fields_for_object / create_item / respond_to_request / dispatch)

This is not good for website health and speed, but a lot worse when wp_debug is set to true, as the server attempts to write this out and it potentially crashes one of the services running the website.

A simple solution might be the ability to toggle the log feature on and off.

fahadmahmood8 commented 3 weeks ago

I am surprised to the stats you provided because this plugin is not logging anything. I used the following function "wc_slw_logger" to log something if I need to troubleshoot something but all of those function call are already commented. But as you suggested, I have implemented a toggle button and made this function dependent on ON/OFF of this new toggle button under the logs tab. It is a good feature anyways, I am going to mention your name in the changelog for this contribution my friend.