How to get date 3 days before today

Its pretty simple really…



Commons Logging

There are a lot of powerful logging libraries available for .net. Among them Microsoft Enterprise library logger, nLog and log4net are really popular and easy to use. Developers still try to write their own and customise these available helpers too. However the purpose of this post is how we can use Commons logging implementation to decouple logging library implementation from our application. Using commons logging allow the application to change to a different logging implementation without recompiling code.

Note: that commons logging does not attempt to initialise or terminate the underlying logging implementation that is used at runtime; that is the responsibility of the application. However many popular logging implementations do automatically initialise themselves; in this case an application may be able to avoid containing any code that is specific to the logging implementation used.

Normally we tend to initialise our loggers in the application code directly, thereby creating a code dependency forever unless we decide to remove each line to code. All the existing logging mechanisms do not come with a common interface. However the solution is much easier. And there is an existing .Net library that does the job for us. I found it at Please follow the link below

It is really easy to use with log4net and common logging solution. Do note that you still need to configure the log4net in your configuration files as you would have normally done and need to also include a new section in your web.config/ appsettings file to direct the Common.Logging API.

Posted in .net, log4net. Tags: . Leave a Comment »