Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in Uncategorized | 1 Comment

LogViewer – A Simple Log Listening Utility

Download LogViewer binary

Donwload LogViewer Source

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

  2. NLog

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. 

Posted in Uncategorized | 7 Comments

Data Binding with Binding Source- It really Sucks

This post is result of amazing tooth gnashing fact i came across, when binding some WinForms controls with Some Access table.
the Code i was using was just simple code as follows:

Dim adp as New OleDBDataAbapter("Select * …","Provider=…..")
Dim ds as New DataSet
adp.Fill(ds)

Me.BindingSource1.DataSource=ds
Me.DataGridView1.DataSource=Me.BindingSource1

The funny bugs start from here onwards only:
Now i added one BindingNavigator and added binded to BindingSource.
When i was clicking AddNew a blank record was coming but in UI the record selected was first records (This is not acceptable). Since it should point to new Blank record.
More funniest things are yet to come.

Now after filling the data in blank records, when i click save the record, it mingled up everything. Just messed up all. It overwritten the first record with new given values. ( if any one expected this). You are adding new record and it is overwritting the existing one, that too without given any notifications.

I dig-ed out this topic more in depth, because i had to find out what was going out-of-box. that i was not able to see. I decided to manually code all CRUD operations. I removed all link between AddNew,Delete ToolStrip Button from Operation they were performing behind scene. Then i manually all operations my-self.

No My dear it is now over. now i faced some really frustrating situation, that i  never expected. i guess any one will not able to guess also. The problems were :
(1) AddNew function was adding 2 records with same data ( Even though all data related coding done manually).
(2) Delete was deleting first row, instead current selected record.

Now Here comes the happy ending on this pathetic situation.
I dig-ed this situation, because it was impacting the next code deliverable i had ti provide. So i have tried with creating Typed Dataset for All database objects using Add new Datasource wizard. Everything went fine. Object were generated and I binded Typed data Objects to binding source. Now everything was going smoothly and all implicit CRUD operation were also going fine.

Later on i tested the same scenario with other database, i gone though same course-of -action. But with Creating Business Objects(DAL) and binding to Binding source was the only solution i found.

The Conclusive remark i want to give is that. Always try to bind Business objects with Binding Source. I guess this will really help somebody.

Cheers
Ashu Fouzdar
.Net Developer
ashu.fouzdar@gmail.com
 

Posted in .NET Development | 2 Comments

Generate DAL in just 5 minutes

Since past few months, i was driving some research for getting a powerful Data Access Layer, that can plug-in any sort of application and can provide powerful feature. Such as:-
(1). Transaction management.
(2). Support for pure Object based programming.( do not have any SQL interacts on developer end).
(3). Give flexibility to generate code automatically.
(4). Support for one-to-many and many-to-many sort of relations between database objects.
(5). Pluggable to any sort application i.e. Web, Standalone, Rich Client.
(6). Support for maximum databases.

I evaluated following DAL softwares.
(1).  EasyObjects.Net
(2).  nHibernate.
(3).  SubSonic.
(4).  CoolStorage.
(5).  DataObjects.NET
(6).  Sooda.
(7).  MyGeneration DOODS
(8).  Gentle.NET
(9).   voidSoft Datablock.
(10). And lastly Typed DataSet from Visual Studio IDE.

I am glad to share that almost every DAL library given above is Free-of-Cost, that comes with GPL or restrictive GPL license. Anyone can add these library to their application and generate small apps, within small fraction of time.

As i already mentioned i was driving this sort of research in sort of finding a good DAL that can fit in my requirements. After evaluating i came to conclusion that. The feature’s i was looking for are available in SubSonic 2.0.3. I never want to say that other DAL do not these feature’s (again, it depends on personal choice and type of evaluations anyone is doing). The most exiting feature i found while using Subsonic as DAL for my window applications are:
(1). Automated code generation using command-line utility sonic.exe.
for ex. sonic generate /server localhost /db AnyDB /generatedNamespace xxxxx.BusinessObjects /appendWith _ /out ".\BO"

(2). Attribute based support for XML serialization, and validation can also be added using attribute.
(3). Based on Proven Enterprise Library architecture.
(4). Support for Object based queries.
(5). Supports transaction facade.
(6). Support of maximum popular databases.
(7). One can define all database parameter’s in application configuration and can switch the database without changing a single line of code.

That’s all i was searching for my small applications. The only thing i came across is no support for table that do not have primary key’s at all.

Hope anybody will get help from this post.

Cheers
Ashu Fouzdar
.Net Developer
Contact me at : ashu.fouzdar@gmail.com

Posted in .NET Development | Leave a comment