can I share ELMAH configuration across apps?
Let's say that I have 5 apps that I want to add ELMAH logging for unhandled exceptions to. Is it possible to set ELMAH up to use a shared config file so that I only have to add one line to the web.config in each application?
开发者_Go百科Ideally I'd like to install ELMAH via Nuget and then add one line to the web.config in the app and bang ELMAH is set. Is this possible?
I like the suggestion by @feanz to create your own custom Elmah Nuget package. My only concern would be the overhead of now needing to ensure that your custom Elmah package stays in sync with version changes to Elmah over time.
I would instead suggest creating and locally hosting a custom Nuget package just for the custom configuration changes that you want to make to Elmah for your apps. You can follow the steps here for how to perform configuration transforms in Nuget. By doing this you will get some benefits:
- Name your package as Elmah.MyCustomConfig (or whatever you like)
- Put the dependency of Elmah on your custom package, so if you install your package and Elmah is not already installed, NuGet will install it into to your application automatically.
- You decouple yourself from maintaining the entire Elmah package just for custom config settings.
You could create your own Nuget package for elmah which you host locally with your own version of the web.config transformations in it. Then you Install-Package Elmah and its already configured the way you like it.
精彩评论