I use ELMAH for error handling on a lot of my projects and recently started using FogBugz again after a brief hiatus. The only problem was that to use FogBugz with BugzScout I had to put code in my applications when I already had ELMAH running. I thought that wasn’t very elegant so I grabbed the ELMAH source and the BugzScout source and hacked together a module for ELMAH that will submit to FogBugz. Please note that the formatting needs work as it submits a bunch of HTML at the moment, which FogBugz is interpreting as plain text. Once I get that fixed I’ll post an update or feel free to send me one if you’re ambitious.

I’ve linked the sample files above if you care to look. Just add these to the ELMAH project and use the custom configuration section…

   1: <errorFogBugz
   2:         area="Misc"
   3:         customerEmail="[email protected]"
   4:         project="Misconfigured"
   5:         url="https://yoururl.fogbugz.com/ScoutSubmit.asp"
   6:         userName="John Doe"
   7:         defaultMessage=""
   8:         forceNewBug="false"
   9:         />

And you have to add the config section to the top…

   1: <section name="errorFogBugz" requirePermission="false" type="Elmah.ErrorFogBugzSectionHandler, Elmah"/>

Finally you add the module to your modules sections…

   1: <httpModules>
   2:     <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
   3:     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
   4:     <add name="MsAjaxDeltaErrorLog" type="Elmah.MsAjaxDeltaErrorLogModule, Elmah"/>
   5:     <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah"/>
   6:     <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
   7:     <add name="ErrorFogBugz" type="Elmah.ErrorFogBugzModule, Elmah"/>
   8:     <!--<add name="FixIIS5xWildcardMapping" type="Elmah.FixIIS5xWildcardMappingModule, Elmah"/>-->
   9: </httpModules>

or for IIS7 use this one…

   1: <system.webServer>
   2:         <validation validateIntegratedModeConfiguration="false"/>
   3:         <modules runAllManagedModulesForAllRequests="true">
   4:             <add name="ErrorMail" preCondition="managedHandler" type="Elmah.ErrorMailModule, Elmah"/>
   5:             <add name="ErrorLog" preCondition="managedHandler" type="Elmah.ErrorLogModule, Elmah"/>
   6:             <add name="MsAjaxDeltaErrorLog" preCondition="managedHandler" type="Elmah.MsAjaxDeltaErrorLogModule, Elmah"/>
   7:             <add name="ErrorTweet" preCondition="managedHandler" type="Elmah.ErrorTweetModule, Elmah"/>
   8:             <add name="ErrorFilter" preCondition="managedHandler" type="Elmah.ErrorFilterModule, Elmah"/>
   9:             <add name="ErrorFogBugz" preCondition="managedHandler" type="Elmah.ErrorFogBugzModule, Elmah"/>
  10:         </modules>
  11:         <handlers>
  12:             <add name="Elmah" preCondition="integratedMode" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
  13:         </handlers>
  14: ...

I hope that someone finds this useful. If there is interest I may package these as a companion library for ELMAH or contribute them to the project.

Comments

Dane Bertram

Cool post! One thing that's new with FogBugz 8 that we've been leveraging internally with our BugzScout reports is the new Code Snippets plugin (http://www.fogcreek.com/FogBugz/plugins/plugin.aspx?ixPlugin=42). It's not really targeted at pre-formatted text in general, but we wrap stack traces in [code][/code] tags so that they won't word-wrap inside the case view in FogBugz. It's not a perfect solution (yet), but it makes reading stack traces in FogBugz *much* easier (screenshot: http://img299.imageshack.us/img299/3217/stacktrace.png).

Dane Bertram

David Aleu

Nice one, works great but indeed needs some formatting. Thanks Bill.

David Aleu

Computer Repair Perth

Your blog is very informative for me. Your code information is also fantastic. Thanks :)

Computer Repair Perth

Comments are closed