You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/01/09 15:02:51 UTC

DO NOT REPLY [Bug 26020] New: - Writing to a file.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26020>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26020

Writing to a file.

           Summary: Writing to a file.
           Product: Ant
           Version: 1.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: javamaniac@aol.com


I am trying to write to a log file from build.xml 
by using below commands: 

<record name="ant_log.log" action="start" />
<echo message="some message">
 <record name="ant_log.log" action="stop" />

when I run ant script from the NetBeans , for the 
first time it creates log file, but when I am 
trying to run it again - it's seems to lock the 
file. Meaning, the file doesn't get updated, and 
I cannot delete it, unless I close NetBeans. If I 
ran same procedure from the command line directly 
it works fine every time.

p.s originally, I opened this bug on NetBeans.org, here's URL for your 
reference:

http://www.netbeans.org/issues/show_bug.cgi?id=38560

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


Re: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 12 Jan 2004, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:
> 
>> > The scenario we have to cater for is a single recorder class (and
>> > associated static table) spanning multiple builds.
>> 
>> What does the current implementation do in this case?
> 
> I believe it tries to write to a closed file.

That should be easy to simulate 8-)

Seriously, whatever we do will be an improvement over the existing
code, then.

Stefan

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


RE: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> > The scenario we have to cater for is a single recorder class (and
> > associated static table) spanning multiple builds.
> 
> What does the current implementation do in this case?
> 
> Stefan
> 

I believe it tries to write to a closed file.

Conor


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


Re: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 12 Jan 2004, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> The scenario we have to cater for is a single recorder class (and
> associated static table) spanning multiple builds.

What does the current implementation do in this case?

Stefan

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


RE: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
>
> This is where the backwards incompatiblity comes in, right?
>

That and the fact that a recorder will no longer have a Build Successful
message, etc.

>
> Can the task keep track of files it has opened during the current
> build and make append default to true if a given file has been used
> before?

It may be possible but might be difficult. The scenario we have to cater for
is a single recorder class (and associated static table) spanning multiple
builds. Distinguishing the "current build" might take some care. I'll look
into it.

Conor



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


Re: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Stefan Bodewig <bo...@apache.org>.
On Sun, 11 Jan 2004, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> IOW, when a recorder is stopped, the file is closed and no other
> output is written to the recorder file. This seems to be the correct
> behaviour to me.

I agree.

> Also, to capture both messages would require an append on the second
> recorder start.

This is where the backwards incompatiblity comes in, right?

There may be situations where you don't know that a specific <record>
task is the second one of the build.

<target name="A">
  <record name="my.log" action="start"/>
    ...
  <record name="my.log" action="stop"/>
</target>

<target name="B">
  <record name="my.log" action="start"/>
    ...
  <record name="my.log" action="stop"/>
</target>

<target name="C" depends="A,B"/>

If B is run without A, it is not the second invocation.

Can the task keep track of files it has opened during the current
build and make append default to true if a given file has been used
before?

Stefan

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


RE: DO NOT REPLY [Bug 26020] New: - Writing to a file.

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
I've implemented a fix for this but it means that reuse of a recorder in a
single build does not perform quite the same as Ant 1.6. For example, this
build

<project name="26020" default="test">
  <target name="test">
    <record name="ant_log.log" action="start" />
    <echo message="some message"/>
    <record name="ant_log.log" action="stop" />

    <record name="ant_log.log" action="start"/>
    <echo message="another message"/>
    <record name="ant_log.log" action="stop" />
  </target>
</project>

gives this as the content of ant_log.log

     [echo] some message
     [echo] another message

BUILD SUCCESSFUL

but will give this with my change:

     [echo] another message

IOW, when a recorder is stopped, the file is closed and no other output is
written to the recorder file. This seems to be the correct behaviour to me.
Also, to capture both messages would require an append on the second
recorder start.

Thoughts?
Conor



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