Taking on Custom Ant Logging, Page 4
Warning on Sub-builds and Loggers
If your Ant script calls other Ant scripts internally (a sub-build), then take warning: the current version of Ant (1.6.5) unfortunately hardcodes the sub-Project's logger to a DefaultLogger, does not propagate BuildListeners, and does not pass the message output level through to the sub-ant build. Brave souls might take a look at a source distribution of Ant and look over the Ant.java task code for possible modification. Before my Ant-related project was complete, I eventually created a custom "Ant" task that allowed me to specify these values as attributes in my main build file.
In this three-article series, I have led you on a trip deep into Ant customization territory. I have shown you how to take control of just about every facet of Ant: writing your own task code, adding new conditionals and file selectors, creating your own supporting types as nested elements as well as using Ant's own types in your tasks, and finally taking complete control over even the logging system itself. While I continue to have some minor, personal complaints about Ant's design, user's manual, and API documentation, it can hardly be argued that the Ant developers have made a very flexible system. With any luck, some of my hard-won knowledge will save you some effort.
Remember, these articles include working example code. Consider the examples to merely be a jumping-off point for your own experimentation and problem solving.
About the Author
Rob Lybarger is a software engineer who has been using Java for nearly a decade and using Ant since its earliest days. He has used various versions of Windows, various distributions of Linux, and, most recently, Mac OS X. While knowing a wide array of software languages, the cross-platform nature of Java and Ant has proven to be a valuable combination for his personal and professional efforts.