-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logger: Refactor logger to DB based implementation #24
Conversation
The file based implementation for the log storage has a flaw - the plugin folders are deleted when upgraded, so using them to store any data is problematic. Instead of using a file for storage we should use some other solution. One possible solution for this is having a separate table for our logs. This PR implements the database based solution.
@kaittodesk I need a second opinion. We have encountered errors that are replicable only in the client environment. The error log has been a great resource for tracking possible errors, however, we must implement a change. The error log should not live in the plugin directory as it gets deleted between version upgrades. The official recommended way is to use the upload directory:
So we have three options to migrate the logger storage:
The number 1 solution has a caveat that when the User has not enabled logging errors we don't receive any helpful debugging information. The second option allows us to better manage log lifetime and we don't have to think about polluting the global log file with information only useful for our plugin context. I would also like to add a "download logs" functionality to the settings page that users could send us when experiencing problems. Allows to show errors in UI, but is more complex. The third option has all of the benefits of the second option but needs access control. I kind of went with the second option first, but I don't think the added DB complexity is justified. So I eventually went with the third option and moved the log storage to the As we have our own log file then I would keep this out of the |
This relates to issue I created for Smaily for WooCommerce plugin - sendsmaily/smaily-woocommerce-plugin#142. Under the linked issue I suggest the correct approach would be to use I think using
The downside of using |
The file based implementation for the log storage has a flaw - the plugin folders are deleted when upgraded, so using them to store any data is problematic. Instead of using a file for storage we should use some other solution. One possible solution for this is having a separate table for our logs. This PR implements the database based solution.