Where does ELMAH save its data?

北战南征 提交于 2019-12-04 07:51:37

问题


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!


回答1:


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.




回答2:


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

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



来源:https://stackoverflow.com/questions/9343517/where-does-elmah-save-its-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!