Douglas,

you can log to a default text log, and then write a target that will send
email to you.

For example:

        <target name="send-email">
                <property name="mail.subject" value="${nant.project.name}
Build ${project.build.number}: ${result}" />
                <mail from="${mail.from}" tolist="${mail.to}"
subject="${mail.subject}" mailhost="${mail.host}" failonerror="false">
                        <files>
                                <includes name="${result}.msgfile.txt" />
                        </files>   
                        <attachments>
                                <includes
name="${build.log.name}.${project.build.number}.txt" />
                        </attachments>
                </mail>
        </target>

You can also use nant.onfailure target to customize the message depending on
the outcome of the build:

<project name="Your project with log emailing">
        <property name="nant.onfailure" value="failure" />

        <!-- execute normal build targets; if anything fails it will
transfer to "failure"; otherwise, it falls through to "success" -->
        <target name="different build tasks">
                <do whatever needs to be done in your build file />
                <!-- this executes only if all previous stuff is successful
-->
                <call target="success" />
        </target>

        <!-- tasks to execute on build success -->
        <target name="success">
                <property name="result" value="success" />
                <tstamp />
                <record name="${build.log.name}.${project.build.number}.txt"
action="Close" failonerror="false" />
                <call target="send-email" />
        </target>

        <!-- executes on build failure -->
        <target name="failure">
                <property name="result" value="failure" />
                <record name="${build.log.name}.${project.build.number}.txt"
action="Close" failonerror="false" />
                <call target="send-email" failonerror="false" />
        </target>
        <target name="send-email">
                ... see above
        </target>
</project>

You can now specify a different list of emails that receive the failure and
success messages.

If you want to get creative, you can parse the log file before sending it in
an email, keeping only interesting bits and format them in the body of the
message.

d.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Douglas R.
Steen
Sent: Wednesday, December 03, 2003 6:57 AM
To: [EMAIL PROTECTED]
Subject: [Nant-users] Specifying -logger in the build file

I'm using the -logger:NAnt.Core.MailLogger commandline option so that I'll
get an email with the build output, but since I want that to happen every
time I run my build file, I'd really like to specify it somehow in the build
file itself.  

Right now I'm just running it from a batch file, which I suppose is okay,
and I know that I could create another build file which would call the first
build file, but both of those solutions seem like hacks.
Isn't there a simple <property> setting that allows me to set commandline
options?

  Douglas R. Steen
  Boulder, CO 



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it help you create
better code?  SHARE THE LOVE, and help us help YOU!  Click Here:
http://sourceforge.net/donate/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to