Add Logging to WordPress in 3 Minutes with this Simple Plugin

Guy Eshet
February 10, 2021
Add logging to WordPress WP Logger

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.

Add logging to WordPress with WP Logger dashboard
For an even better search when you want to add logging to WordPress, you can filter logs based on priority and status. For example, if I was looking for an error that occurred a few days ago, I could type:
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!

base cta background

The Best of AI Magic

Stay ahead with the latest in Generative AI.
Guy Eshet from Geneartive AI Expert

Guy Eshet

Guy Eshet is an expert in Blockchain technologies, NFTs, and Web development. Guy has been developing software for over 15 years, currently focusing on Web3. Guy is fluent in 5 languages, loves meeting new people, learning about various topics, and improving his skills.
Comment & Share Your Thoughts
Your email will not be published. Required fields are marked *

Recommended For You

footer astronaut  |  All Rights Reserved © 2022Privacy PolicyTerms & Conditions
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.