You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ji...@orcz.cz on 2002/10/24 09:27:20 UTC

How to redirect output to file ?

I can't make the FOP debug information like this

[DEBUG]: Input mode:
[DEBUG]: FO
[DEBUG]: fo input file: C:\DOCUME~1\JN\LOCALS~1\Temp\Fop\TMP
[DEBUG]: Output mode:
[DEBUG]: awt on screen
etc...

to be printed to file. I use this code :

FileOutputStream fos = new FileOutputStream(filename);
PrintStream ps = new PrintStream(fos);
PrintStream out_orig = System.out;
System.setOut(ps);
....
here I run FOP
...
fos.close();
System.setOut(out_orig);


But the file is empty and everything still goes to standard output.

Any ideas how to solve this ? Thanks.

                         J.N.






Re: How to redirect output to file ?

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Thu, 2002-10-24 at 09:27, Jiri_Nejedly@orcz.cz wrote:
> I can't make the FOP debug information like this
> 
> [DEBUG]: Input mode:
> [DEBUG]: FO
> [DEBUG]: fo input file: C:\DOCUME~1\JN\LOCALS~1\Temp\Fop\TMP
> [DEBUG]: Output mode:
> [DEBUG]: awt on screen
> etc...
> 
> to be printed to file. I use this code :
> 
> FileOutputStream fos = new FileOutputStream(filename);
> PrintStream ps = new PrintStream(fos);
> PrintStream out_orig = System.out;
> System.setOut(ps);
> ....
> here I run FOP
> ...
> fos.close();
> System.setOut(out_orig);
> 
> 
> But the file is empty and everything still goes to standard output.

FOP uses a logger for logging, depending on which version etc. you are
probably using avalon logkit.
I don't know exactly how it works but it probably directs the log output
to stdout and not the stream that you set as the system output.

The proper way to handle it would be to configure your logger. For
example the avalon logger this would be the place to start:
http://jakarta.apache.org/avalon/logkit/





Re: How to redirect output to file ?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jiri_Nejedly@orcz.cz wrote:
> I can't make the FOP debug information like this
...
> to be printed to file. I use this code :
> 
> FileOutputStream fos = new FileOutputStream(filename);
> PrintStream ps = new PrintStream(fos);
> PrintStream out_orig = System.out;
> System.setOut(ps);
...
> But the file is empty and everything still goes to standard output.

The log messages usually go to System.err.

J.Pietschmann