My search for uniformaty in logging led me to Microsoft's Logging application block; Like all other or most of other blocks Logging blocks packs good functionality.
In short the architecture of logging block has 2 tiers at bottom is Event Sinks and top is Formatter
Events Sinks could be of different types (e.g Database, Flat File, Email, Event Log or custom).
Formatters could be text formatter, XML formatter or custom one
When we want to use this block ;
1. Download and install the Enterprise Library from microsoft site
2. Open your solution; add reference to Microsoft.Practices.EnterpriseLibrary.Loggging.dll
3. Import namespaces Microsoft.Practices.EnterpriseLibrary.Loggging
4. Add Logger.Write() calls whereever you require logging
and it will start logging
Now if you want to ur log to go into database instead of flat file just change the config file.
Actually there's interesting application that comes with Enterprise Library which will help doing this config stuff
Although all this sounds cool; I can't find what I was expecting out of it. The block stores information in Property Name and Property Value pair
so there are certain properties that block exposes e.g MachineName, ApplicationName, Message etc. but now if you want to have ur own property you need
to change the block code and recompile it. Other than that I found it very helpful I'm looking fwd to use it more and more
Cheers
Vishy