At my works we produce websites like they are going out of fashion (ie a lot of sites per year)
I want to install ELMAH on all of these as company practice and then log everything centrally for viewing by our developers. The process has to be really easy as otherwise its use won't take off.
I was thinking of setting up a central Google Reader account and hooking all the RSS feeds for the ELMAH installations into it.
my concern is that Google says that they only check about once an hour, and this means that if you are using the "in memory" storage for ELMAH there is a chance that the errors will be missed when an app pool restarts.
Email is pretty good, but if everyone starts recieving ELMAH error messages they'll start to ignore them - maybe i could setup an extra exchange mailbox JUST for this to keep things seperate?
your thoughts will be greatly appreciated
(ps this MAY be thought of as subjective - but i believe that someone probably has THE answer among a number of subjective answers, making it a valid question)
With a few changes in the Elmah sourcecode, you can have all your sites writing to the same database. You can then configure one mastersite that displays all of the exceptions with the application that threw it.
Eric King shows how in this blog post http://blog.devadept.com/2010/02/using-elmah-with-multiple-applications.html
To summarize:
Create two additional stored procedures in the database called ELMAH_GetErrorsXML_Master and ELMAH_GetErrorXML_Master without the applicationname parameter.
Then create a SQLMasterErrorLog class based on the existing ‘SQLErrorLog.cs’ class. In this edit the GetErrorXml() and GetErrorsXML() methods to call the new stored procedures
public static SqlCommand GetErrorXml(string appName, Guid id)
{
SqlCommand command = new SqlCommand("ELMAH_GetErrorXml_Master");
command.CommandType = CommandType.StoredProcedure;
SqlParameterCollection parameters = command.Parameters;
parameters.Add("@ErrorId", SqlDbType.UniqueIdentifier).Value = id;
return command;
}
public static SqlCommand GetErrorsXml(string appName, int pageIndex, int pageSize)
{
SqlCommand command = new SqlCommand("ELMAH_GetErrorsXml_Master");
command.CommandType = CommandType.StoredProcedure;
SqlParameterCollection parameters = command.Parameters;
parameters.Add("@PageIndex", SqlDbType.Int).Value = pageIndex;
parameters.Add("@PageSize", SqlDbType.Int).Value = pageSize;
parameters.Add("@TotalCount", SqlDbType.Int).Direction = ParameterDirection.Output;
return command;
}
Change the RendorErrors() method in the ErrorLogPage class to display an extra column in the log viewer table for the Application Name.
Add the following to the table header
headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Host", "host-col"));
headRow.Cells.Add(FormatCell(new TableHeaderCell(), "App", "app-col"));
And the following in the for loop creating the childrows
bodyRow.Cells.Add(FormatCell(new TableCell(), error.HostName, "host-col"));
bodyRow.Cells.Add(FormatCell(new TableCell(), error.ApplicationName, "app-col"));
Now all you need is a single empty website that has elmah configured. Instead of the normal SqlErrorLog use the following
<errorLog type="Elmah.SqlMasterErrorLog, Elmah" connectionStringName="elmah"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With