Click here to Skip to main content
15,879,326 members
Articles / Desktop Programming / Windows Forms
Article

LogViewer - A Simple Log Listening Utility

Rate me:
Please Sign up or sign in to vote.
4.81/5 (16 votes)
1 Jan 2009CDDL4 min read 83.8K   8.3K   85   18
Simple log listening utility that listens to logs events from multiple sources, e.g. TCP/UDP, File logs, Remoting channels
NLog_Client

Introduction

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. 

The Problem

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:

  1. It must support listening of log events from log file(s).
  2. It must support listening of log events over network, i.e. TCP or UDP port.
  3. It must support listening of log events on remoting channels.
  4. 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.

Solution

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:

  1. Listening of log events from log file. (It is implemented using FileSystemWatcher component, thanks to .NET Framework team).
  2. Listening of log events over TCP protocol. (For supporting NLog NetworkTarget. It is implemented using System.Net.Sockets, again thanks to .NET framework team).
  3. Listening of log events over UDP protocol. (For supporting log4net UdpAppender and NLog NetworkTarget, thanks to log4net contributors).
  4. 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.

Credits

I would like to extend the credits of this article to the following open source logging frameworks:

  1. Log4Net

    Image 2
  2. NLog

    Image 3

DISCLAIMER

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.   

History 

  • Initial revision 1.0 on Jan 02 2009

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Architect
Canada Canada
Ashutosh is an avid programmer, who “lives to code”. One can always find him busy seeking challenging programming assignments on various complex problems ranging from Data management, Classification, Optimization, Security, Network analysis, Distributed computing.

He started his programming stint with “C”; he has also worked on C++, Visual Basic, JAVA, Perl, FoxPro, PASCAL, Shell Scripting, and Perl. Currently, he is proficient and working on C#.

His area of interest includes Distributed Computing, Analytic and Business Intelligence, Large Enterprise System Architectures, Enterprise Content Management.

He is an advocate of Open source and likes to share solutions with open source communities like
1.Stack Overflow
2. nHibernate
.

Award's :
Prize winner in Competition "Best article of May 2008"

Articles :
Click to see my CodeProject Articles

Blog :
Share a solution | Explore the .NET world

Link'd :


His Favorite(s) :
nHibernate - The best ORM.
nHibernate Contributed Tools

Comments and Discussions

 
PraiseCleanest code ever Pin
Member 89700106-Jun-18 13:03
Member 89700106-Jun-18 13:03 
QuestionUDP multi Log Pin
Hacko12323-Jun-15 5:42
Hacko12323-Jun-15 5:42 
BugINFO lines are shown in the wrong color Pin
Member 1039517011-Nov-13 16:38
Member 1039517011-Nov-13 16:38 
GeneralMy vote of 5 Pin
Member 275996326-Jun-12 20:54
Member 275996326-Jun-12 20:54 
Generalgood article Pin
Donsw16-Feb-09 16:10
Donsw16-Feb-09 16:10 
GeneralRe: good article Pin
Ashutosh Phoujdar16-Feb-09 18:35
Ashutosh Phoujdar16-Feb-09 18:35 
GeneralNice one Pin
Abhijit Jana9-Feb-09 20:20
professionalAbhijit Jana9-Feb-09 20:20 
GeneralRe: Nice one Pin
Ashutosh Phoujdar9-Feb-09 21:52
Ashutosh Phoujdar9-Feb-09 21:52 
Thanks Smile | :)


GeneralGood stuff Pin
Dr.Luiji7-Jan-09 5:52
professionalDr.Luiji7-Jan-09 5:52 
GeneralRe: Good stuff Pin
Ashutosh Phoujdar7-Jan-09 19:07
Ashutosh Phoujdar7-Jan-09 19:07 
GeneralNice tool Pin
Ron440776-Jan-09 3:35
Ron440776-Jan-09 3:35 
GeneralRe: Nice tool Pin
Ashutosh Phoujdar6-Jan-09 19:43
Ashutosh Phoujdar6-Jan-09 19:43 
GeneralNot working? Pin
jumper7772-Jun-16 4:42
jumper7772-Jun-16 4:42 
GeneralRe: Not working? Pin
Jasonblack197621-May-17 6:28
Jasonblack197621-May-17 6:28 
GeneralMore customization Pin
metalsandman4-Jan-09 22:31
metalsandman4-Jan-09 22:31 
GeneralRe: More customization Pin
Ashutosh Phoujdar5-Jan-09 2:19
Ashutosh Phoujdar5-Jan-09 2:19 
GeneralTraceTool Pin
zlezj3-Jan-09 1:27
zlezj3-Jan-09 1:27 
GeneralRe: TraceTool Pin
Ashutosh Phoujdar4-Jan-09 19:32
Ashutosh Phoujdar4-Jan-09 19:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.