March 7, 2008
BugzScoutAppender for log4net
I have been using a custom publisher for Microsoft.ExceptionManagement to submit bugs into FogBugz via BugzScout. For Shipper 2.0 I've decided to update several components including Microsoft.ExceptionManagement with log4net. But I did not want to give up automatic bug report addiction. So I wrote the BugzScoutAppender.
BugzScoutAppender is a custom log4net Appender that submits the LoggingEvent to FogBugz via BugzScout. If you are already wired for log4net, then it is really easy to add BugzScoutAppender. Here is a sample configuration:
<appender name="BugzScoutAppender" type="FogBugz.Appender.BugzScoutAppender, BugzScoutAppender">
<layout type="log4net.Layout.PatternLayout" value="%date [%thread] %level %logger - %message%newline" />
<descriptionLayout type="log4net.Layout.PatternLayout" value="%level %message"/>
<url value="" /> <!-- e.g. <url value="http://localhost/fogbugz/scoutSubmit.asp" /> -->
<username value="" /> <!-- An existing username -->
<project value="" /> <!-- An existing project -->
<area value="" /> <!-- An existing area -->
<email value="" /> <!-- The submitters email -->
<addUserAndMachineInformation value="false" />
<appendAssemblyList value="false" />
</appender>
You can override Username, Project, Area, and Email in your code by adding the corresponding value to the log4net.ThreadContext.Properties. For example:
log4net.ThreadContext.Properties["Email"] = "test@company.com";
log.Error("Hey this is an error!");
log4net.ThreadContext.Properties.Remove("Email");
Both the source code and binary is attached. The source code includes an example application that excersizes the appender.
download
This site looks much better in a browser that supports current web standards, but it is accessible to any browser.
Download one now
Some parts of this site will not work effectively on this older browser.
Please consider
updating your browser