About/Contact

Steve Trefethen

Steve Trefethen is a Director of Engineering at Reply. Contact me

View my LinkedIn profile


Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
$720 in referrals so far!


Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.



Configuring CruiseControl.NET to publish exceptions outside of build tasks

December 13 2007 8:22AM
The other day I blogged about plug-ins I’ve been writing for CruiseControl.NET for a custom process that I’m working on. I’ve written a custom <sourcecontrol> plug-in that monitors a directory on an FTP server for new files. If files are present they’re downloaded and a build is triggered. The <sourcecontrol> tag of my ccnet.config file section looks like this:
<sourcecontrol type="ftp"> <remoteHost>localhost</remoteHost> <userName>User</userName> <password>pwd</password> <localPath>c:\temp\</localPath> <remoteDir>out</remoteDir> <timeOut>2</timeOut> <fileMask>*.*</fileMask> </sourcecontrol>

A problem I was running into was that exceptions, like failed FTP connections, within my sourcecontrol plug-in weren’t being published using my email publisher as configured in ccnet.config. Prior to v1.1 this used to work using if you had following tag in your ccnet.config file:

<publishExceptions>true</publishExceptions>

With v1.1 came support for log4net replacing the functionality of this tag which is mentioned here but without further details as to the alternative. To publish these exceptions you have to configure a log4net SmtpAppender to sent email which can be done from app.config as follows:

<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender"> <to value="to@b.com" /> <from value="from@b.com" /> <subject value="test logging message" /> <smtpHost value="smtpserver" /> <bufferSize value="512" /> <lossy value="true" /> <evaluator type="log4net.Core.LevelEvaluator"> <threshold value="WARN"/> </evaluator> <layout type="log4net.Layout.PatternLayout"> <conversionPattern
value="%newline%date [%thread] %-5level %logger [%property{NDC}] -
%message%newline%newline%newline"
/> </layout> </appender>

Btw, don’t forget to configure this appender in the <root> node of the <log4net> section as well. It’s a bit of a bummer that you have to have two Smtp setups to handle these kinds of exceptions but at least you have the capability to get the information published.

[Update: Dec 19, 2007] To clarify the exception I'm referring to above is occurs in my implementation of ISourceControl.GetModifications.

FacebookDel.icio.usDigg It!

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading