Then you have to write a task ... <exec executable="baciccompile"... output="basiccompile.out"/> <analyseBasicOutput output="basiccompile.out" errors="basiccompile.err" success="basiccompile.success" haltOnError="false" errorProperty="basiccompile.hasErrors" />
public class AnalyseBasicOutputTask extends Task { ... public static final String ERROR_MESSAGE = ... public void setOutput(File ) { this.output = f; } public void setErrors(File f) { this.errors = f; } public void setSuccess(File f) { this.success = f; } public void setHaltOnError(boolean b) ... public void setErrorProperty(String s) ... public void execute() { // analyse the output-File and split the error/success // messages. Write them into the two files. // Maybe do other processing. if (hasErrors()) { // save into an Ant property getProject().setNewProperty( errorProperty, getErrors() ); if (haltOnError) { throw new BuildException(ERROR_MESSAGE, getLocation() ); } } } public boolean hasErrors() ... public String getErrors() ... } http://ant.apache.org/manual/tutorial-writing-tasks.html http://ant.apache.org/manual/tutorial-tasks-filesets-properties.html Jan >-----Ursprüngliche Nachricht----- >Von: James Oltmans [mailto:[EMAIL PROTECTED] >Gesendet: Montag, 25. Juni 2007 17:21 >An: Ant Users List >Betreff: RE: Processing Ant log files > >That would not work; the process that causes the error is not >that granular. Hundreds of basic files are compiled by one >basic program and that program does not produce a log file for >each compilation but the entire compile process. So there will >be hundreds of successful compile messages (which span >multiple lines) and a handful of error messages (which also >span multiple lines). >Otherwise that would be an excellent solution, thanks. > >James > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Sent: Wednesday, June 20, 2007 12:33 AM >To: user@ant.apache.org >Subject: AW: Processing Ant log files > >Just thinking ... >- redirecting output of exec into logfiles > <exec ex="comp1" output="comp1.out" error="comp1.err"/> >- maybe appending the program name to logfiles > <echo message="Log from comp1" append="true" file="comp1.out"/> > <echo message="Log from comp1" append="true" file="comp1.err"/> >- copying logfiles with error into extra directory > <copy><selector><contains> >- merging the logfiles > <concat> >??? > > >Jan > >>-----Ursprüngliche Nachricht----- >>Von: James Oltmans [mailto:[EMAIL PROTECTED] >>Gesendet: Mittwoch, 20. Juni 2007 00:14 >>An: user@ant.apache.org >>Betreff: Processing Ant log files >> >>Hello all, >> >> >> >>I have a problem that I am not sure if ant has a built in method for >>handling. I would like to process log files for errors, warnings and >>possible system levels messages. The log is being generated by ant but >>the echoed output is produced by a legacy system (hence why I >>can't just >>use a premade task to find all these errors). The errors and warnings >>can be 1-50 lines in length. I believe it would be best to parse for >>these errors using regexes. It appears that filterchain filters are >>geared towards single line applications only. >> >> >> >>For example I would like to take the following: >> >> [exec] >>------------------------------------------------------------ >> >> [exec] COMPILE PROGRAM_A >> >> >> >> [exec] Compiling PROGRAM_A >> >> [exec] compilation finished >> >> [exec] SUCCESS compiling PROGRAM_A >> >> [exec] >>------------------------------------------------------------ >> >> >> >> >> >> [exec] >>------------------------------------------------------------ >> >> [exec] COMPILE PROGRAM_B >> >> >> >> [exec] Compiling PROGRAM_B >> >> [exec] main program: syntax error at or before >> >> [exec] <line 23> ...PWR = "This program, dependent files and >>dependent facilities is" >> >> [exec] >>--------------------------------------------------------------- >>------^Ex >>pecting: end-of-file,END >> >> >> >> [exec] compilation failed >> >> [exec] FAILURE compiling PROGRAM_B >> >> [exec] >>------------------------------------------------------------ >> >> >> >>And take just the second compilation's output and create a report of >>build failures/warnings. >> >> >> >>I would like to grab all the compilation failures and other system >>failures that occur in the build and include them in a build report >>email. Here is my desired output for inclusion in the build report >>email: >> >>Compile failures: >> >> Compiling PROGRAM_B >> >> main program: syntax error at or before >> >> <line 23> ...PWR = "This program, dependent files and dependent >>facilities is" >> >> >>--------------------------------------------------------------- >>------^Ex >>pecting: end-of-file,END >> >> compilation failed >> >> >> >>In order to do this I would have to capture all or most of the text >>between the two [exec] ---------------------------------------------- >>lines (also note that the errors could be any length so any >assumptions >>about the number of lines would be insufficient). Is there an >>ant native >>function or a 3rd party open-source or 3rd party products that can >>process log files in this way or should I consider creating a custom >>task or custom filterreader? >> >> >> >>If your recommendation is a filterreader, what's a good example to >>follow? >> >> >> >>James Oltmans >>SCM Administrator >> >>Bolo Systems, Inc. >>[EMAIL PROTECTED] >> >> >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]