I'd like to use Elmah to log errors from multiple customers' ASP.net Web Forms applications, to a central error database, each error logged with a unique application name.
I realise this can be easily set in the elmah.errorLog.applicationName
attribute in web.config, but all our customers have standard web.config files, with the unique settings for each system in appSettings.config and connectionStrings.config files referenced by configSource
or file
attributes in web.config.
As the elmah
sectionGroup
in web.config doesn't allow the use of file
or configSource
, how can I set the applicationName
for Elmah uniquely for each system?
I don't want to programmatically set the attribute in web.config, as it could be lost when the web.config is overwritten in the future.
I tried setting the ErrorLog.ApplicationName property in Global.asax.Application_Start()
, like this, but the value I set was ignored.
Dim logger As Elmah.ErrorLog = Elmah.ErrorLog.GetDefault(Nothing)
logger.ApplicationName = "Testing 123"
Any advice would be much appreciated, as Elmah fits all our needs, we just need to be able to uniquely identify the errors it logs in the central error database.