ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: How to read a a particular log file and echo the message from "Build.xml" ?
Date Fri, 10 Jun 2005 05:06:35 GMT
 
Hi,


-----Original Message-----
From: venkatesan_gandhi@bankone.com
[mailto:venkatesan_gandhi@bankone.com] 
Sent: Thursday, June 09, 2005 5:03 PM
To: Ant Users List
Subject: How to read a a particular log file and echo the message from
"Build.xml" ?

/*
>From Build.xml,How to read a  particular log file(which is in the same 
folder) and echo the message of a particular field in the log file  from

"Build.xml"?

Is ant provide those facility andshould i have to read a script for this
?
*/


yup

1. load file with <loadfile srcfile .... />

2. get the special part | line you want extracted / read in that file
    with (nested) filterchains. You may use head- and tailfilter,
tokenfilter
    in conjunction with regular expressions (when using jdk => 1.4 or
with
    extralibrary jakarta-oro)
    the result may be stored in a property and then 
    <echo>${your.property}</echo>

just have a look in the manual for loadfile, filterchains

Beside that you may also use a script task with 
groovy | javascript | beanshell | netrexx ... if other things don't
work.

But in most cases you don't need a special script.

example :

<loadfile srcfile="./${deploy.folderer}/${your.logfile}"
property="deploy.target">
    <filterchain>
        <headfilter lines="16"/>
    </filterchain>
    <filterchain>
        <tailfilter lines="1"/>
        <striplinebreaks/>
        <tokenfilter>
                <replaceregex pattern="(.*):(.*\d\d:\d\d)"
replace="\2"/>
         </tokenfilter>    
    </filterchain>
</loadfile>


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message