TheWebGuy
TheWebGuy

Reputation: 12645

NLog, Elmah + shared library

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?

Upvotes: 4

Views: 1226

Answers (1)

ccellar
ccellar

Reputation: 10344

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.

Upvotes: 4

Related Questions