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:[EMAIL PROTECTED]
> > 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:[EMAIL PROTECTED]
> > > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

Reply via email to