Debugging Windows services, especially in a test or production environment, can be tricky. In many cases you won't have access to the box. You certainly won't have the ability to step through the code.
Thus, you are usually forced to monitor log files, looking for an indication of where the problem occurred. The typical method is to start by opening the file in Notepad. Then, when you want to see more recent log entries, you close and reopen the file. This is mildly annoying when dealing with a single service. If your business workflow is split among multiple services, this becomes incredibly inefficient.
An easier solution is to use a log monitor app such as BareTail. For this little demo I am using the free version of the tool.
I have three separate services logging to files named "process1.log", "process2.log" and "process3.log." To keep it simple I am only logging the RequestID for each received request. Here I have loaded all three logs into BareTail.
When I send a new request to the system it should update each log file. BareTail monitors the logs and displays any updates. In the screenshot below, note the new Request ID #2918891. Note also that the document tabs for each file show a green arrow - this indicates an update was made.
As you view each tab, the green arrow will be cleared to visually show which files you have already reviewed.
Say you were trying to debug a request that fails to make it through the system. A quick glance at the document tabs will show you how far a request made it through the system. After reviewing each log (to clear the green markers) we submit another request. In the following screenshot, note that we have a green arrow for process1.log and process2.log, but none for process3.log. So either the second process failed to send the message on, or the third process failed to receive it.
Subscribe to:
Post Comments (Atom)
You might find log4j's Chainsaw interesting...it allows you to tail log files, even remotely (see VFSLogFilePatternReceiver from the help-about menu). If you want to know more, feel free to email me: scott deboy at gmail com
ReplyDeleteYes, it's a Java app, but it works pretty well.
I briefly looked at Chainsaw (v2.) It looks interesting but didn't seem to be clear how to use efficiently. If I need more detailed log analysis, I may take another look.
ReplyDeleteThanks for the info.