Over the years that I have spent as a software developer, I have realized the essence of perfect logging in application development. As part of development, writing logging statements seems to be chaotic task, although it gives a perfect solution while debugging applications especially in production environment (where we don't even have a simple CLR debugger).
In context of production debugging logging proves a metal over other strategies, because logging becomes the only way to communicate the process that is going under the hood (application). We can neither set a debug watch nor may we have a break point to stop execution at a certain point of time. Although we may use
debug.assert statement, again it is not very convenient. Altogether in my experience application seems like a black box, having no stiff controls over the execution.
Now, I would like to give a brief about the motivation behind the article. It is perfectly justified that one may start using logging for the sake of debugging the application, but at the same time some sort of tools must exist to evaluate the logs while the application is running. In my point of view, I am interested in a tool that serves the following commitments:
- It must support listening of log events from log file(s).
- It must support listening of log events over network, i.e. TCP or UDP port.
- It must support listening of log events on remoting channels.
- And the most important, it must belong to open source and come with the complete source.
I altogether agree that there might be some more criteria to evaluate a log listening utility, but all the above criteria are the ones that I was most concerned about.
I hope you are following the article until now, and it seems that there is a necessity of a utility that can provide an intuitive User interface and multiple ways to listen to log events from multiple sources.
Hence I researched this topic and came to a decisive list of following utilities:
I would like to appreciate all the above utilities, but none of the above were suited to my requirements because of the following reasons:
- Some are too restrictive in the sense of supporting customization.
- Some are coming from the Java world, and one must know some Java basic to use them.
- Some need their own configuration settings to be maintained.
- And lastly, some are commercial, and do not support listening from multiple sources at same time in freeware edition.
After all this tooth gnashing exercise, I decided to go with my own implementation. Because that was the only resort left for me, and after all I need to believe in my skills (Yes, I can do this).
Aftermath, there is good news that after an overwhelming exercise with my PC and burning some midnight oil while reading some texts, I devised a working and stable application. I am heavily using this application for all of my logging needs. Now I would like to give some heads-up about the utility which I am discussing. Well the utility I developed is known as LogViewer - A Simple log listening utility and it supports the following behavior:
- Listening of log events from log file. (It is implemented using FileSystemWatcher component, thanks to .NET Framework team).
- Listening of log events over TCP protocol. (For supporting NLog NetworkTarget. It is implemented using System.Net.Sockets, again thanks to .NET framework team).
- Listening of log events over UDP protocol. (For supporting log4net UdpAppender and NLog NetworkTarget, thanks to log4net contributors).
- Listening on log events over Remoting channel (For supporting log4net RemotingAppender, thanks to log4net contributors).
From the above description, it is pretty much clear that it is a simple log event listening utility that supports listening of log events from multiple sources, that too simultaneously. The remaining functionality will become much clearer when you start using it.
Well that's all folks.
"Have a promising and fulfilling new year"
Please forward your suggestions to me, and please vote for this article if you like this utility.
I would like to extend the credits of this article to the following open source logging frameworks:
THIS UTILITY IS NOT FOLLOWING ANY STANDARD DESIGN PATTERN AND IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Initial revision 1.0 on Jan 02 2009