Hi,

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to