March 19, 2019
Hot Topics:

Taking on Custom Ant Logging

  • November 16, 2006
  • By Rob Lybarger
  • Send Email »
  • More Articles »

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.


Article #1 : Introduction to Custom Ant Tasks
Article #2 : More on Custom Ant Tasks
RFC3164 (BSD syslog protocol)
Configuring the syslog service in Mac OS X 10.4

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.

Page 4 of 4

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date