NLog, Elmah + shared library

只愿长相守 提交于 2019-12-06 04:18:57

问题


I am trying to come up with a way to create a common library for all my MVC projects. I started off really simple with BaseController and BaseModel classes. Easy stuff!

Now in my projects I would like to either use Elmah or NLog for logging exceptions and/or tracing info.

Can anyone give me some ideas on the best practices for writing a common library to support both?


回答1:


I would use NLog as base for your logging. I've created a small target for NLog which could be used to route exceptions to ELMA. You'll find it at https://github.com/ccellar/nlog-elmah-target.

With this target you are able to use logger.*Exception( ... ) to log the exception and to pass it to ELMAH.



来源:https://stackoverflow.com/questions/6610735/nlog-elmah-shared-library

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