ELMAH vs Enterprise Library Exception Handling Block

一个人想着一个人 提交于 2019-12-12 07:13:58

问题


My team is currently in the process of building an ASP.NET MVC application, and we're trying to decide which of these frameworks to implement to deal with error handling and logging.

What are the reasons for choosing one of these over the other?


回答1:


Personally, I've been using Enterprise Library for a number of our clients and I have yet to use ELMAH. Here's my thoughts on Ent Lib.

  • It will take you a bit to get up to speed with Ent Lib - it's not a 5 second install and start using it thing.
  • There's alot of configuration to do in the app.config/web.config file just to make it work. That said, once you understand it, it easier on other projects.
  • You must implement the Logging Block, not just the Exception Handling Block to log the information somewhere (event log, flat file, database, etc.)
  • It's not just for logging exceptions. For example, many of our clients want to get log events for when a user logs in or logs out of an application.
  • You can use the configuration file to change how logging works depending on the environment (i.e. Log exceptions for Production, log everything for Dev, etc.).
  • It's not just for web, but for all kinds of applications.

A cursory glance at ELMAH leads me to believe that it's a great way to get something up quick. Longer term, you may want something with additional power.




回答2:


ELMAH is simple, easy to use, and easy to implement. EntLib is big, "enterprisey", and powerful. In your case, based on the little I know about your situation, I would hesitate to recommend anything. However if I had to pick one for you I would say ELMAH for the reasons stated.




回答3:


I may be off base here, which is quite often the case, but EntLibrary is meant to help develop exception handling whereas ELMAH is jsut going to show you when and where exceptions occured. If you just want a report of exceptions use ELMAH, if you need more power EntLib.




回答4:


Also, Elmah is designed specifically for capturing and logging unhandled exceptions. It can be configured to log caught exceptions, but that is a recent addition and not its primary purpose.



来源:https://stackoverflow.com/questions/940888/elmah-vs-enterprise-library-exception-handling-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!