Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does ELMAH save its data?

Tags:

c#

.net

elmah

I just installed ELMAH.MVC (more info here) and was wondering where its data is saved. I read that you can choose to set up database for storage but seems that the default install uses "in memory"? How does it work? If I recycle the app pool or IIS website do I loose all the data? Thanks!

like image 817
Joao Leme Avatar asked Feb 18 '12 17:02

Joao Leme


People also ask

How do I view ELMAH logs?

Build the application, run it in the browser, and navigate to http://www.yoursite.com/elmah.axd. You are prompted to log in before you see the content. After a successful authentication, you see a web page to remotely view the entire log of recorded exceptions.

What are ELMAH logs?

ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file.

What is the use of ELMAH?

ELMAH enables logging of all unhandled exceptions. ELMAH logs all errors in many storages, like - SQL Server, MySQL, Randon Access Memory (RAM), SQL Lite, and Oracle. ELMAH has functionality to download all errors in CSV file.

What is ELMAH Axd?

Description. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.


2 Answers

Yes, by default it uses memory storage. When your application pool is restarted, you loose elmah data. If I remember well, old versions of elmah used App_Data folder for storing xml files...If you want to use database to store logs, just specify connection string in your elmah config section:

<elmah> ... <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahConnectionString"/>   ... </elmah> 

You should have ElmahConnectionString in your connectionStrings section, something like this:

<connectionStrings>     <add name="ElmahConnectionString "          connectionString="Initial Catalog=my_database;data source=.\SQLEXPRESS;Integrated Security=SSPI;"          providerName="System.Data.SqlClient" /> ... </connectionStrings> 

Here you can find example web.config file.

like image 167
Aleksandar Vucetic Avatar answered Sep 23 '22 20:09

Aleksandar Vucetic


Read in "Examining the ErrorLog Class" topic, and you will find your answer

Using HTTP Modules and Handlers to Create Pluggable ASP.NET Components

like image 40
Dot Freelancer Avatar answered Sep 22 '22 20:09

Dot Freelancer