How This Underrated Technique Saved My Team Hours of Debugging

Rijul Rajesh - Jan 28 - - Dev Community

The Hurdles of Debugging: Time, Effort and Annoyance

Ever felt like you are stuck in a never-ending bunch of errors? The process of debugging can be frustrating, without proper methods it can cost us hours, effort and annoyance.

Consider this scenario: You are dealing with a bug in your app where the submit button is not working. Where's the first place you go? The logs.

Here is what our logs look like, There are 18 logs displayed.

Alt text

Among the 18 logs, we need to manually find out the error log.
In larger systems, the number of logs can add up. It takes lots of time and effort to find the relevant log.

How I Overcame the Hurdles

Seeing such hurdles, I had to find a technique to address this problem.
The problem is that, there is too much information in the form of log lines written by various team members.

In most of the cases these logs are written without much care and don't provide value.

Due to lack of standards in code reviews, Logging Practices are inconsistent.
This results in challenges for team members who need to get relevant information from these logs.

So, the solution is to set the standards for the team regarding Logging.
For helping to setup the standards, we already have something that is collecting dust: Logging Levels. Not every team uses it to its fullest potential.

For those who don't know, Logging Levels are a way of categorizing the logs based on their severity and purpose.

So let's return to the same scenario: we have a problem to debug, and we are looking at the logs.

Alt text

In the above image, from 18 logs I have filtered it down to 1 relevant log. I have done this using Logging Levels.

I used the devtools to display only logs at the error logging level. Amazing isn't it?

This is also pretty useful when working in teams. Any developer without previous experience in the app can jump into the problem directly without dealing with the confusion caused by the other logs.

Apply the Technique: Real-Life Examples

Continue reading the full article at https://journal.hexmos.com/timesaving-debugging-technique/

. . . . . . . . .