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?
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