ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Dantas Rocha" <ad-ro...@uol.com.br>
Subject RE: Capture Javac output
Date Wed, 02 Mar 2005 20:01:10 GMT
I'm trying to work with DefaultLogger, and created this code:

    Project project = new Project();
       
    DefaultLogger logger;

    try {
      logger = new DefaultLogger();
      FileOutputStream fo = new FileOutputStream(new File("build.log"));
      logger.setOutputPrintStream(new PrintStream(fo));
      logger.setErrorPrintStream(new PrintStream(fo));
      project.addBuildListener(logger);
    } 
    catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    
    project.addBuildListener(logger);
    project.init(); 

The file was created, but nothing happns when I run the task. The log file is empty...

Any ideas?

Thanks


> Right, I agree. However, in case you persist in the programmatic way, 
> have a look at BuildLogger and BuildListener, and how they are hooked up 
> to the Project. You could use DefaultLogger, setting the output and 
> error PrintStream to your file, achieving what you want. --DD 
> 
> > -----Original Message----- 
> > From: Anderson, Rob (Global Trade) [mailto:Rob.Anderson@nike.com] 
> > I would suggest writting a build.xml and running Ant, rather than 
> > programming a class to do your compile. Then it becomes as easy as 
> running 
> > a command and capturing the output. 
> > 
> > -Rob A 
> > 
> > > -----Original Message----- 
> > > From: Andre Dantas Rocha [mailto:ad-rocha@uol.com.br] 
> > > I'm compiling some java files using an Ant project: 
> > > 
> > > Project project = createProject(); 
> > > Javac javac = (Javac) project.createTask("javac"); 
> > > javac.init(); 
> > > ... 
> > > javac.perform(); 
> > > 
> > > And would like to capture the output messages in a log file. 
> > > 
> > > How can I do that? 
> > > 
> > > Thanks, 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org 
> For additional commands, e-mail: user-help@ant.apache.org 
> 
> 
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message