You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by James Oltmans <jo...@bolosystems.com> on 2007/06/20 00:14:13 UTC

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. 
joltmans@bolosystems.com