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. And if you are making a primarily static site, client-side logging may not show you any data you couldn’t find with Google Analytics. But, this can be a tricky issue once an application is in production. When more people use 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.
User Reports are Not Enough
This is a possible workflow due to relying on user reports! I.E., A workflow I lived
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.
Relying on user feedback to discover client-side problems is 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
Broadly, it allows you to collect log data you otherwise couldn’t. You can’t troubleshoot problems you don’t discover. With access to error logs from the browser for each session, you have all the data you need to find problems and improve the user experience before you get significant complaints. But there are specific scenarios/tasks where client-side logging is particularly useful.
When Working With Single-Page Applications
With client-side logging, you can be sure you catch all of the issues with the application. Because no matter how much testing you do, your users will find ways to use the application you have never thought they would, and all of that action is on the client for single-page applications. I know this because we’ve had unexpected user behavior in our own angular app, and client-side logging helped us discover it.
So much of what happens with single-page applications results from what happens on the client, and having the context available may help you solve problems with the back end. Or at least give them proper context. Instead of errors logged on the server existing in isolation, you can use client-side logs combined with that data, and get a better picture of what happened.
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 actual 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.
When Part of a Log Management System
If you want a free log viewer you can use with your .NET projects, you can try out Loupe Desktop in the link below: