1
votes

I am looking for a clean and simple logging solution for my ASP.NET Webforms application. I recently got up and running with NLog based on this NLog tutorial.

After doing all of this setup work I realized ELMAH might be the easiest solution because it seems like it is just plug and play.

Two of my requirements: The logging must be asynchronous and be able to log to a SQLServer db. I know I am getting both with NLog.

So do most use something like NLog for handled exceptions and ELMAH for unhandled exceptions?

1

1 Answers

2
votes

From https://code.google.com/p/elmah/wiki/TechnicalNotes

There an Error object is constructed from the Exception and then either ReportErrorAsync or ReportError is called depending on the async setting from the configuration.

So, basically yes, elmah can email errors either async or sync, depending on the configuration setting "async". And yes, it can also write to a SQL server database. Looking further and at the source, it looks like the async might actually only apply for the mail module, not the logging module but I would need to look closer to confirm.

to set it for the mail module apply the "async" property to your mail configuration such as:

<elmah>
 <errorMail from="[email protected]"
  to="[email protected]"
  subject="Book Reviews Runtime Error"
  async="true" />
</elmah>