Async Database log

94 views
Skip to first unread message

Nasser Brake

unread,
Sep 25, 2013, 7:04:06 AM9/25/13
to el...@googlegroups.com
Hello,

I am using ELMAH in a dot.net 3.5 ASP.NET application using the MySqlErrorLog. I have the requirment to have DB write-operations run as async operations.  ErrorMailModule already implements this out of the box.  

Is it possible to configure MySqlErrorLog to write in an asynchronous manner?  If this is not possible, I am planning on inheriting from MySqlErrorlog and overriding the Log(Error) operation. Are there any pitfalls to consider doing this?

Thank you!




Atif Aziz

unread,
Sep 25, 2013, 4:55:18 PM9/25/13
to el...@googlegroups.com
Is it possible to configure MySqlErrorLog to write in an asynchronous manner?

No, it is not.

I am planning on inheriting from MySqlErrorlog and overriding the Log(Error) operation. Are there any pitfalls to consider doing this?

I don't know MySQL but in any event, overriding Log(Error) won't help you at all. You'll want to implement BeginLog and EndLog instead and ensure that the MySQL API supports overlapped I/O. The only ErrorLog implementation in ELMAH that does this is SqlErrorLog for MS SQL Server. Even with BeginLog and EngLog implemented, the Error event in ASP.NET is processed synchronously. The reason SqlErrorLog uses overlapped I/O is mainly for full retrieval during an entire download of a log. ErrorMailModule supports async operation by using another thread for a number of reasons and is therefore equally flawed. But the rationale behind nonetheless offering the option was that SMTP servers can be slower to respond than databases (especially in shared hosting environment) and to let the Error event & HTTP transactions complete sooner and in parallel.

- Atif


--
You received this message because you are subscribed to the Google Groups "ELMAH" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elmah+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages