What is Client-Side Logging?
By default, errors in the browser are written into the console rather than into a file. The browser console is a great resource when developing applications. But it has an inherent weakness: none of the console output is saved by default. Once the browser session ends or the user changes pages, any data is virtually gone for good.
That may not be a problem during development. You can save any console output you really need. But, this can be a tricky issue once an application is in production. When more people are using your application in ways you never intended, there are bound to be unexpected errors. Since this data is not saved anywhere by default, many developers rely on user reports to discover these errors.
Client-side logging is an alternative to this. It allows you to capture in-browser errors and send them to a location where developers can easily view them. This way, no one relies on user reports and can catch errors as they happen in production.
User Reports are Not Enough
This is a possible workflow due to relying on user reports!
The user may not know they have encountered an error. Most people do not have the console open while browsing the web and will not always know when an error occurs. What is unexpected behavior for your application may not register as a problem for the user at all.
The user can be an unreliable narrator. If someone struggles with a technical problem, they may not be in the best frame of mind to discuss the issue. They may not remember the steps they took that resulted in the error. Or worse, remember incorrectly.
It may be difficult to replicate an error. There are a lot of different browsers, devices, and ways to use your application. Frankly, too many variables to guarantee you can replicate the error in the first place.
The user is likely to stop using your application rather than call you about an error. By the time a user wants to email or call you about an error, it may have already happened to ten other users who decided to find something else instead. In a world where applications rely on free versions or trials to get people’s attention, many users can cut bait easily if something doesn’t work for them.
I have worked on projects that did not have client-side logging, and it was very frustrating. For every user that was kind enough to call and report they were having an issue, I knew there were ones that would have never bothered. Honestly, it was also embarrassing. I would have to ask a lot of questions to get a sense of what the issue was. The result was often a spotty user account and a lot of their time spent.
How Does Client-Side Logging Make Troubleshooting Easier?
This is an example of a client-side logging workflow using Loupe Server
The number one feature of client-side logging is that it allows you to collect log data you otherwise couldn’t. But there are additional benefits that are worth mentioning as well:
Complete Logging for Single-Page Applications
With client-side logging, you can be sure you catch all of the issues with the application.
So much of what happens with Single-Page Applications results from what happens on the client, and having the context available can also help you solve problems with the back end. For Single-Page Applications, client-side logging will reveal issues with the application’s frontend and provide you context for what is going on in the backend.
Whether an error appears for one user or one thousand users makes a significant difference when prioritizing an error. Client-side logging gives you the ability to make these decisions based on real data. This works better if you have a log management system that can count the occurrences of a specific error for you instead of doing a hand count. But no matter which situation you are in, the good news is that you have the option.
Client-Side Logging is Even Better When Part of a Log Management System
Or you can learn how to use it hands-on, and install the agent with the link below.