Add Logging to WordPress in 3 Minutes with this Simple Plugin
One of the best things about WordPress is that it's easy to use. However, when things get complicated or not ordinary, we need a way to debug. The default WordPress debug log requires you to set the entire website on Debug mode and for a Production website or live once it's an overhead. But what if there was a different way? How can you quickly add logging to WordPress?
One day I was trying to connect a website with an email list provider when it occurred to me that the process of registering new users for my WooCommerce store may be failing. This could be due to intermittent errors, so I needed a way to find where things are going wrong quickly.
A quick search online brought me to this little plugin, called (surprisingly enough) WP Logger, which lets you add logging to WordPress by creating a new table in your database and allows you to log from anywhere in your code using this simple hook:
So How Do I Add Logging to WordPress?
This will be available to see on your dashboard under Tools -> Logger. You could filter the logs saved in the Database, see all the information, and sort the records.
do_action( 'logger', $data, 'warning' ); do_action( 'logger', $data, 'error' );
Which can classify the logs saved in your database by priority for easier search and filtering later on.
What's The Bottom Line?
This logging system is, however, is a good solution to add logging to WordPress only for small-scale logging and low throughput. If you run a small e-commerce website or a blog, it's the easiest and fastest way to log in. On the other hand, if that's not the case, I would go for more robust solutions. Such a solution could be using Logstash with Adapteus, but it requires more advanced coding skills. Otherwise, I think it's a great and easy solution to add logging to WordPress in minutes.
If you're reading this article, I'm guessing you're a techy guy. One of the things I love is using technology to boost my website performance. Lately, I've been using this AMAZING AI-powered content generator to improve almost every single word on my website. It's completely nuts!
I recommend you check it out - or at least go through this list of AI-powered marketing copy tools for your site. You won't believe how much time and effort you will save with it. I was skeptical in the beginning, but now I'm all in, check it out too!