Elmah mvc erase error logs after site restart

I have enabled Elmah.mvc via Nuget in my mvc application. It stores the logs correctly, but when I make any changes to the web.config or restart the site, all saved error logs are erased. Is there a way to keep my logs forever in some place, probably inside the project folder or somewhere else. Pls suggest.

+3


source to share


1 answer


Yes! All you have to do is tell Elmah to write logs to files instead of memory like this (in the elmah web.config session):

<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />

      

to be stored in memory it should be:



<errorLog type="Elmah.MemoryErrorLog, Elmah" size="1000"/>

      

Don't forget to enable write access in the "logPath" folder.

+2


source







All Articles