Redirecting log information

Richard Bair richard.bair at oracle.com
Tue May 8 08:21:11 PDT 2012


Not all JavaFx code is consistent on logging. In particular, the graphics code just uses System.out and System.err, whereas controls use a Logger which goes to System.out unless you enable JDK logging, in which case it uses a JDK Logger.

I feel we ought to use the same logging method consistently, and then it should be quite easy for you to redirect by utilizing the JDK logging mechanism?

On May 8, 2012, at 5:19 AM, Tom Schindl <tom.schindl at bestsolution.at> wrote:

> Hi,
> 
> The problem is the point at which one redirects the stderr. Take a look
> at this:
> 
>> public class TestApp extends Application {
>> 
>>    @Override
>>    public void start(Stage primaryStage) {
>>        ByteArrayOutputStream out = new ByteArrayOutputStream();
>>        PrintStream orig = System.err;
>>        System.setErr(new PrintStream(out)); // Works
>>        
> 
> vs.
> 
>> public class TestApp extends Application {
>> 
>>    @Override
>>    public void start(Stage primaryStage) {
>>        ByteArrayOutputStream out = new ByteArrayOutputStream();
>>        PrintStream orig = System.err;
>>        
>>        Group g = new Group();
>>        System.setErr(new PrintStream(out)); // Does not work
> 
> The problem is that Option 1 is not possible for me because I only have
> to redirect the logging information from JavaFX while your solution
> completely redirects STDERR with is not making much sense!
> 
> Sad enough the Logging code is not yet opensourced so I still hope that
> a JavaFX dev with access to the code can help me.
> 
> So I repeat my question. Can I somehow set a custom logger to the JavaFX
> platform?
> 
> Tom
> 
> Am 08.05.12 00:22, schrieb Tom Schindl:
>> I've tried that already and couldn't make it work. Did you try it and it
>> worked? Then I'd give another try.
>> 
>> Tom
>> 
>> Am 08.05.12 00:25, schrieb Christian Schudt:
>>> You can redirect the System.err stream to your logger.
>>> 
>>> See here:
>>> 
>>> https://forums.oracle.com/forums/thread.jspa?messageID=10304321
>>> http://stackoverflow.com/questions/1200175/log4j-redirect-stdout-to-dailyrollingfileappender/1370033#1370033
>>> 
>>> Christian
>>> 
>>> 
>>> Am 07.05.2012 um 23:06 schrieb Tom Schindl:
>>> 
>>>> Hi,
>>>> 
>>>> I'm having a hard time redirecting log output generated by JavaFX
>>>> library. Is there some API available or documentation?
>>>> 
>>>> Tom
>>>> 
>>>> -- 
>>>> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
>>>> ------------------------------------------------------------------------
>>>> tom schindl                 geschäftsführer/CEO
>>>> ------------------------------------------------------------------------
>>>> eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
>>>> http://www.BestSolution.at                      phone    ++43 512 935834
>>> 
>> 
>> 
> 
> 
> -- 
> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
> ------------------------------------------------------------------------
> tom schindl                 geschäftsführer/CEO
> ------------------------------------------------------------------------
> eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
> http://www.BestSolution.at                      phone    ++43 512 935834


More information about the openjfx-dev mailing list