You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Erik Hatcher <ja...@ehatchersolutions.com> on 2001/12/13 01:22:08 UTC

[SUBMIT] MailLogger

Finally a good answer to the age-old FAQ - how do I send build reports from
Ant?  MailLogger!

Attached is MailLogger.java which builds upon the recent patches made to
DefaultLogger, allowing subclasses to hook into what is actually logged
(such that verbosity mode and emacs mode are taken into account also).

MailLogger makes use of "magic" properties so that a properties file is not
necessary, although a properties file can be specified
(-DMailLogger.properties.file=...).  So properties can be set in the build
file, via -D, or via the MailLogger.properties.file specified file.

Here is an example build file using it:

<project default="test">
  <property name="MailLogger.from"
value="jakarta-ant@ehatchersolutions.com"/>
  <property name="MailLogger.failure.to"
value="jakarta-ant@ehatchersolutions.com"/>
  <property name="MailLogger.success.to"
value="jakarta-ant@ehatchersolutions.com"/>
  <property name="MailLogger.success.subject" value="Woohoo!"/>
  <property name="MailLogger.failure.subject" value="Oops!"/>

  <target name="test">
    <echo message="hello out there"/>
  </target>

  <target name="fail"><fail/></target>
</project>

And this was run from the command-line like:
    ant -logger org.apache.tools.ant.listener.MailLogger

The Javadoc comments provide more details on the properties used, whether
they are required or not, and any default value.

Let me know if there are any problems, suggestions, comments. The main issue
was what to do when an error occurs, and of course in buildFinished there is
no use in throwing an exception, so its simply written to System.out.

    Erik


Re: [SUBMIT] MailLogger

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
D'oh!  I meant for it to be 4 spaces indent...(just changed my jEdit
settings, it must have picked up my XML two-space setting somehow).

And I wholeheartedly agree about sticking with the style of the original
(and I apologize for going against it inadvertently here).  I recommend
Ambler's _The Elements of Java Style_.

    Rule #1: Adhere to the style of the original.

Erik "will do better next time" Hatcher

----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, December 14, 2001 7:40 AM
Subject: Re: [SUBMIT] MailLogger


> On Fri, 14 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
> wrote:
>
> > I did notice it changed, and I wouldn't have done that had it been
> > an established module.
>
> Actually, I tried to mimic yours, but failed at some points.  It is
> always better to stick with what is there than to create some starnge
> mix of styles IMHO.
>
> BTW, four space indentation seems to be common around here.
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 14 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> I did notice it changed, and I wouldn't have done that had it been
> an established module.

Actually, I tried to mimic yours, but failed at some points.  It is
always better to stick with what is there than to create some starnge
mix of styles IMHO.

BTW, four space indentation seems to be common around here.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Oh, sorry... I just re-ran JavaStyle within jEdit because I lengthened some
of the Javadoc comments.  :)

I did notice it changed, and I wouldn't have done that had it been an
established module.

    Erik



----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, December 14, 2001 7:22 AM
Subject: Re: [SUBMIT] MailLogger


> On Thu, 13 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
> wrote:
>
> > I modified the MailLogger slightly
>
> You don't like my indentation style, eh? 8-)
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 13 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> I modified the MailLogger slightly

You don't like my indentation style, eh? 8-)

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>


> Without looking at the code:  Some documentation for it to put into
> the user manual and a patch against faq.xml would be great (I
> volunteer to enter the date of the first nightly build that contains
> MailLogger myself 8-).

Patch attached (in .zip format to avoid the new .html file from getting
caught).

I modified the MailLogger slightly (the Javadoc had a mistake, and I made it
slightly more forgiving so that less properties are initially required -
i..e MailLogger.from not required if its not going to send an e-mail).

My modification to toc.html is probably not 100% final, as it needs to jump
to a sub-TOC rather than go straight to the listeners.html page.

Diane?  Want to fix it up for me some?

Anything else that needs to be taken care of to polish it off?

Could someone double check the info I put on listeners.html to make sure its
all accurate?  I tried to bullet out the info on each one, and Log4jListener
is fairly complex to explain.  Oh, and I already see that I forgot to
mention log4j.properties and log4j.configuration.  I can patch that in later
if no one beats me to it.

    Erik




Re: [SUBMIT] MailLogger

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Diane Holt" <ho...@yahoo.com>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Thursday, December 13, 2001 6:51 AM
Subject: Re: [SUBMIT] MailLogger


> --- Stefan Bodewig <bo...@apache.org> wrote:
> > On Thu, 13 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
> > wrote:
> >
> > > Or should there be a new page that gets linked from somewhere?
> >
> > +1
>
> The "Running Ant" section is where Ant's flags and their usage are
> discussed, so I was thinking adding a sub-section in there would make
> sense.
>
> > > If so, where should it be linked from?
> >
> > The main menu after optional tasks.
>
> I'm also thinking we might want to add a "Table of Contents" frame that
> lists the sub-sections for the "Installing Ant", "Running Ant", and "Using
> Ant" sections, the way we have one for "Built-In Tasks", "Optional Tasks",
> and "Editor/IDE Integration", so people can more easily see what's covered
> in them (and get to the sub-sections via a link). I can add that, if
> people think it's a good thing to do.

yeah, a start frame would be good with

1. what version of ant the docs are for
2. the homepage of the project




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 13 Dec 2001, Diane Holt <ho...@yahoo.com> wrote:

> I'm also thinking we might want to add a "Table of Contents" frame
> that lists the sub-sections for the "Installing Ant", "Running Ant",
> and "Using Ant" sections,

+1

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Diane Holt <ho...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
> On Thu, 13 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
> wrote:
> 
> > Or should there be a new page that gets linked from somewhere?
> 
> +1

The "Running Ant" section is where Ant's flags and their usage are
discussed, so I was thinking adding a sub-section in there would make
sense.

> > If so, where should it be linked from?
> 
> The main menu after optional tasks.

I'm also thinking we might want to add a "Table of Contents" frame that
lists the sub-sections for the "Installing Ant", "Running Ant", and "Using
Ant" sections, the way we have one for "Built-In Tasks", "Optional Tasks",
and "Editor/IDE Integration", so people can more easily see what's covered
in them (and get to the sub-sections via a link). I can add that, if
people think it's a good thing to do.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 13 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> Oh geez.... and I thought my job was done when it compiled
> successfully....  :)

To quote Ted Husted from a mail he sent to the general list yesterday:
"The more you do, the more you are supposed to do".

> We don't currently have any information on loggers/listeners in the
> documentation, do we?

Not that a could see it, no.  There is a very short section in
"Developing with Ant".

> Or should there be a new page that gets linked from somewhere?

+1

> If so, where should it be linked from?

The main menu after optional tasks.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
Sent: Thursday, December 13, 2001 3:20 AM


> Without looking at the code:  Some documentation for it to put into
> the user manual and a patch against faq.xml would be great (I
> volunteer to enter the date of the first nightly build that contains
> MailLogger myself 8-).

Oh geez.... and I thought my job was done when it compiled successfully....
:)

We don't currently have any information on loggers/listeners in the
documentation, do we?  What would be the right spot for adding that?  Or
should there be a new page that gets linked from somewhere?  If so, where
should it be linked from?

The XmlLogger (er, I mean *listener*) could be documented briefly along with
the Log4j one.  NoBannerLogger.  Any others while I'm at it?  I'll just make
a first pass at getting a page listing them all with brief explanations of
them.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 12 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> Finally a good answer to the age-old FAQ - how do I send build
> reports from Ant?  MailLogger!

Thanks!

> Let me know if there are any problems, suggestions, comments.

Without looking at the code:  Some documentation for it to put into
the user manual and a patch against faq.xml would be great (I
volunteer to enter the date of the first nightly build that contains
MailLogger myself 8-).

> The main issue was what to do when an error occurs, and of course in
> buildFinished there is no use in throwing an exception, so its
> simply written to System.out.

+1

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
Sent: Thursday, December 13, 2001 7:26 AM

> I've commited it - you will find I've modified it slightly to make it
> work on JDK 1.1 as well 8-)

Sheesh!  When will I ever learn?! Or.... when will the rest of the world
upgrade?!  :)

    Erik




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] MailLogger

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 12 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> Finally a good answer to the age-old FAQ - how do I send build
> reports from Ant?  MailLogger!

I've commited it - you will find I've modified it slightly to make it
work on JDK 1.1 as well 8-)

Thanks

        Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>