AmyW
AmyW

Reputation: 323

How to log an exception to Elmah on localhost?

I need to test implementing JSNLog in an ASP.NET web application on localhost before rolling out the changes to the live site. The web app uses Elmah for logging, which was implemented several years ago and works fine.

I've included JSNLog into the project using the NuGet Package Manager (VS 2015) and have added some log entries. I would like to test logging an error on localhost to ensure it is setup properly, and will not cause issues in production.

Presently, Elmah can not log errors when running on localhost. The connection string name is set up for the web servers which are behind a load balancer.

Does anyone know of a way to modify the web.config file so that Elmah will log to localhost? I'll only be making temporary edits to the web.config file while working on localhost as I want to preserve the existing ability to log errors for the live site.

Let me know if any additional information would be helpful. Thanks!

Upvotes: 2

Views: 740

Answers (1)

AmyW
AmyW

Reputation: 323

I should've searched a little longer as I found the answer to my question. I can now log locally by commenting out the existing <errorlog> entry in the web config that contains a database connection string for the 'connectionStringName' and adding the following...

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

Upvotes: 2

Related Questions