Should I use a logging framework with ASP.NET MVC 2?
I'm getting ready for my 开发者_StackOverflow中文版first ASP.NET MVC 2 project and was wondering whether ASP.NET Tracing is sufficient for any logging I might need to do. Is anyone using a logging framework like log4net or NLog with an ASP.NET MVC 2 application, and if so, what additional functionality does it provide that ASP.NET Tracing lacks?
You should check out ELMAH. It does a lot for you. http://code.google.com/p/elmah/wiki/MVC
GIBRALTAR is an option if you're willing to consider a commercial solution. It integrates ASP.NET Tracing, ELMAH-like exception logging and ASP.NET Health Monitoring.
If you're interested, we have videos, full documentation and live chat on our website along with a full-featured 30-day trial.
A year later, I guess I can answer my own question. I ended up using NLog, and overall have found it very easy to use, with one exception: to allow NLog to write to a file when the ASP.NET MVC site is running in IIS (vs. Cassini), you have to grant the appropriate permissions to the folder for the App Pool user.
精彩评论