Why logging is important in Distributed Systems architecture?

When we design for distributed systems logging is one of the important thing that we need to consider. Why is it so important? As we all know, when we take a distributed system there are many layers involved and also many third party integrations such as facebook, twitter, payment gateways, etc. All these component together may build your enterprise solution.

So the problem arises when it comes to locate issues within your system. The business needs are changing and new competitors comes up all around the world and no one can rest, sometimes you may get requirements to be implemented over night. So these requirements need to be implemented and deployed to the target users as quickly as possible and we can’t afford to have bugs in these releases as they will end up with catastrophic results to the end users.

Debugging would be an ideal and the apparent solution for this, but believe me if you have several different layers in your solution and some third party integrations, it is not. Because you’ll have to spend hours to locate the locations to put the break points and have to run the debugger several times to identify the issue. This is like brain surgery hard scenario and you can’t spend time one these. And if you have any asynchronous processing and any threads involved, identifying an issue will be more difficult than anything else.

The ideal solution is to introduce some logging mechanism as early as possible. Logging is the actual story of your system’s processes getting executed. It tells a story about the inputs, the execution of the process with the input data and the expected results. If you would properly add logging all these information can be easily identified and it is easier to deal with the issues than using debugging. You can pin point and identify the issues and deal with them as quickly as possible. Because you know the issues and where to look since all the relevant information including the errors are logged in.

What are the ideal logging mechanisms available out there? As a .NET developer I strongly recommend LogForNet, which is a highly configurable logging frame work that you can easily implement. Or else you can come up with a solution of your own, such as creating a SQL Server database to store all the issues and provide a nice interface to show the list of issues, the data, and other information. Additionally you could trigger an email to the development leads in case of an abnormal scenario. Also you could use the windows event logger. The .NET framework itself has some classes that allow you to log information to the event logger under the System.Diagnostics name space.

Also when implementing logging mechanisms you need to have some mechanism to switch on and off it, as it will be costly in a production environment. But this all depends on the situation and the domain. One solution could be used is to log only the highly mission critical processes in the production where you could locate the issues, or if it is highly required then you could leave the logging running, but as I have explained it all depends on the particular scenario.

So if you are developing distributed systems, add a logging mechanism to your solution, because it helps you to ensure a delivery of bug free product to the end user.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s