I have set up elmah to log exceptions on my SQL server. Is there any way to define a fallback mechanism if the SQL server fails. I would like elmah to start logging to xml files if the sql server is inaccessible. Any idea how to do that?
Elmah doesn't yet support fallback or concurrent logging locations.
What to do if Elmah can't reach the database to log an exception?
I released a composite errorlog which address exactly this issue.
You can install it via Nuget or copy it from sources into your projects.
More details in my answer here.
Related
I have used Elmah for many of my web applications till date Thanks to Atif Aziz.
Now I am trying to use Elmah in one of my windows based application. Before implementing
I m trying out some Examples and so far everything works Good.
But Do we have any configuration which can help me stopping Elmah at once ?
My Client doesnt want to have Elmah enabled for few of his Environment. I didnt come across
such kind of settings in Elmah except I have heard once about ErrorEmail configuration.
DO any one knows how to stop Elmah using configuration from logging emails ?
Thanks in advance.
I am using MVC 3 with SQL Server 2008 R2 DB.
I installed elmah 1.2.2 and SQL Server script.
Might anybody have some detailed information on how to setup Elmah with SQL Server 2008.
I checked online but could not find detailed information.
Since you have already run the SQL Server setup script and installed Elmah in your MVC application, you should just need to add the following to your web.config to have Elmah send its logs to your sql server instance.
<elmah>
...
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionStringName="<definedConnectionString>"
applicationName="MyAppName"/>
...
</elmah>
Keeping in mind that you will need to replace "<definedConnectionString>" with the name of the connection string that points to your SQl 2008 instance from your <connectionStrings> section of your web.config.
I would also recommend reading through the following 5 part series: Logging Errors with ELMAH and MVC 3, it contains a lot of great recommendations for using ELMAH with MVC. Also you might consider using installing the Elmah.MVC NuGet Package to change the default behavior of Elmah within an MVC application.
I have created a c++ ATL web service in visual studio 2005. I want to have detailed logs for my web service as what request come or weather any exception happened during the Database call.
I am hosting my web service through IIS. I know that IIS create a log file if logging is enabled But i want to have some more control over those logs in terms of format.
Is there any method to use IIS system itself to implement our own logs inside that log file or
Should I implement a multithreaded logging system which will push logs to a text file.
Thanks
If you want logging beyond what IIS offers natively, you will either have to implement your own logger or make use of any of dozens of loggers already out there.
One that a lot of people love is Peantheios: http://www.pantheios.org/
There are many out there.
The simple answer to your question, though, is that IIS does not have built-in facilities for logging beyond what you see in the GUI.
How do I get ELMAH to store the cached errors in my database?
Has anyone implemented it already? If yes please guide me how to do that step by steps please?
Thank you
Here's an article that describes how to configure ELMAH to log to a SQL Server database.
http://www.codeproject.com/KB/ThirdParty/ErrorloggingUsingElmah.aspx
I have elmah setup to use SqlErrorLog and this is running fine on both my local using the developer webserver, and my integration environment under IIS. On my production box elmah is able to log exceptions with XmlFileErrorLog writting to the app_data directory. When I switch back to SqlErrorLog I get nadda. I have ensured that the database exists has the required table and three procedures. I have tested the connectionstring. I have compared the web.configs from my local to prod and the only differences are the database server name in the connection strings.
Any thoughts as to what else can be blocking in a production installation?
~-=Mike=-~
Have you properly setup the permissions on the database for ELMAH? Depending on if you are you using impersonation with your web application, you may have to grant privileges to additional users to the stored procedures/tables.