Posted by Henry Rivera on
Working with concurrent code can be a real pain, because it can be difficult to track execution in multiple parts of the code base. Even the trusty debugger can get difficult to use with this kind of code. I’ll show you how logs make it easy to see the application behavior and identify problems. This is especially true when your code is running in the wild on a remote server and you are trying to diagnose problems.
Logging is one of the first tools in a developer’s kit for fixing timing and deadlock issues. When you debug concurrent code, the debugger may appear to jump around as different parts of the code are executed. This is true for both multithreaded and asynchronous code. A log file allows you to quickly see the behavior of your application without slowly stepping through tasks in different parts of the code base. Let’s run through a famous example so you can see exactly what I mean.