ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Murdoch <>
Subject Re: MailLogger and Sound
Date Tue, 04 Jun 2002 01:20:07 GMT
On Tue, 4 Jun 2002 09:25, Erik Hatcher wrote:
> That wouldn't really work.  I mean, it *would* work, but you'd end up
> having to override every method and defeat the purpose of subclassing.
> NoBannerLogger is at the same inheritance level as DefaultLogger.
> Having a better thought out design that allows filtering chains would be
> better than trying to think of work-arounds using the existing stuff.

In myrmidon, our solution was to change the way listeners get configured, to 
work exactly the same way as tasks and data types get configured.  That is, 
they get configured from an xml element.  Doesn't matter where the xml comes 
from - it may be from the build file, or a config file, or assembled from 
command-line options, or whatever.  You can use all the goodness that you can 
use for tasks or types: nested elements, properties, references, polymorphic 
types, and so on.

What this lets you do, is to compose loggers at runtime, rather than needing 
to add a new logger class for each combination of format and destination.  
Polymorhpic types are particularly handy for this.  For example, say we were 
to split the default logger into a formatter and a log sink.  It would be 
easy to swap in a different formatter (xml, say, or no banner) while still 
sending the output to the console.  Or to swap in a different sink (email, or 
a file) or swap both.  Using polymorphic types also makes it simple to add 
new logger implementations (or formatters or sinks or whatever).  Just plonk 
down an antlib in (say) $ANTHOME/lib and you're done.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message