views:

104

answers:

1

Hi every one!

I'm writing an application in asp.net mvc. I have got presentation layer, controllers and viewModel layer, document layer ( document model [I use ravendb] and repositories) and a framework layer.

Currently I'm wondering how to design logging. I have chosen Nlog + Ninject.Logging extensions.

My question is what information should I write to log ? ( in debug / release ) I know that all exceptions should be logged...

Does anyone have some expirience with it ?

A: 

Well-controlled application logging is always multilevel. Optimally you would set a logging strategy before you embark on writing an application. Main purpose of logging is problem diagnosis & debugging but also performance & usage monitoring and security auditing.

It's impossible to suggest a right strategy without more information of the purpose logging package in your application.

However in your implementation, I would advice you to consider the following:

  • Configuration: Logging components may support programmatic and file-based configuration. The latter is better, as it allows us to avoid changing our source code to switch to a different type of logging behavior.

  • Flexibility: A logging implementation should provide flexibility in terms of what to log and where to log. Also, we should be able to prioritize logging information based on its level of importance.

  • Output: The way that logging information can be output to a preferred destination is important for the success of any logging implementation.

  • Runtime and Programming overhead.

Hypnos
Thanks for your reply. I think its helpful.
aph5