ant logfile /home/cruise/yourgreatproject/log.xml does not exist

ant logfile /home/cruise/yourgreatproject/log.xml does not exist

(image taken from losiek's photostream)

Welcome to the first post of the Build Doctor that isn't in the Planet TW feed. If you're reading this via RSS: thank you. Thank you for subscribing. The point of this exercise was to actually know who my readers are. And now I know.

Back to the post. I've been helping someone set up Ant and CruiseControl. He mailed me last night to say that he got a log message saying that that the log.xml file didn't exist. The short answer is that the Ant build failed.

The longer answer is that CruiseControl calls Ant with an argument to make it use the XmlLogger. Then CruiseControl can hoover up the XML file, and display the output in the Dashboard. What appears to happen is that if your build fails very quickly, the log file isn't written. So all CruiseControl can do is complain about the missing log file. It all makes sense when you read the code:

if (!file.exists()) {                
throw new
CruiseControlException("ant logfile " + file.getAbsolutePath() + " does not exist.");
} else if (file.length() == 0) {
throw new CruiseControlException("ant logfile " + file.getAbsolutePath()
+ " is empty. Your build probably failed. Check your CruiseControl logs.");

Of course, there's other reasons why this could fail, but every time I get this message, I find out that it's down to a very broken build or broken Ant install. I'm tempted to try and reproduce this issue with the XmlLogger.