asp.netasp.net-mvcelmahelmah.mvc

How to implement machine name in elmah subject line?


I want to carry the machine name in ELMAH subject line. As in developing environment want to keep the track that from which machine error is coming. So I want implement subject line with proper machine name. What I should do?

<elmah>
    <errorMail name="exceptionMail" 
       from="devsupport@abc.co.in" 
       to="devsupport@abc.co.in" 
       async="true"  
       subject="Error log from [should come machine name here]" 
       smtpPort="0" 
       useSsl="true"/>
    <security allowRemoteAccess="yes" />
</elmah>

Solution

  • As far as I can see, there's no way to do this in config alone - you would have to write some code to handle this requirement.

    On the other hand - it seems pretty simple and straightforward to write that code.

    See this blog post Customizing ELMAH’s Error Emails by Scott Mitchell on how to do it.