Is there any way to programmatically set the application name in Elmah?

后端 未结 2 2075
野性不改
野性不改 2021-01-02 00:33

I need to change the app name based on what configuration I\'m using in Visual Studio. For example, if I\'m in Debug configuration, I want the app name to show as \'App_Debu

2条回答
  •  执念已碎
    2021-01-02 01:25

    This can now be done purely in markup. Just add an applicationName attribute to the errorLog element in the section of the web.config file. Example:

    
    

    I've tested this and it works both when logging an exception and when viewing the log via Elmah.axd.

    In the case of the OP, one would imagine it can be set programatically too but I didn't test that. For me and I imagine for most scenarios the markup approach is sufficient.

提交回复
热议问题