Reading Elmah log in custom code

82 views
Skip to first unread message

Phil Harris

unread,
May 4, 2017, 1:17:10 PM5/4/17
to ELMAH
Hi everyone,

Can anyone tell me how I can read the Elmah log in C#? I want to display the errors in a custom way in MVC but I can't see which part of the API I should be using to e.g. "Get all Elmah errors last 24 hours"

Many thanks

Atif Aziz

unread,
May 4, 2017, 1:46:51 PM5/4/17
to el...@googlegroups.com
Hi Phil,

You would simple use ErrorLog.GetErrors to get a page of errors at a time. The errors are always returned in the reverse chronological order so you would just keep paging (in a loop) until you find an error older than 24 hours or whatever criteria you have.

Unless C# is your only cup of tea, you may also want to think about a pure HTML + JavaScript version. Have a look at the elvue project to get started if that sounds interesting.

- 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phil Harris

unread,
Jul 3, 2017, 11:51:46 AM7/3/17
to ELMAH
Thank you sir, I'll give it a try
Reply all
Reply to author
Forward
0 new messages