Redirecting log information
Richard Bair
richard.bair at oracle.com
Tue May 8 09:54:40 PDT 2012
Ya, both JDK logging and JFX logging have the same flag checks available.
On May 8, 2012, at 9:06 AM, Phil Race <philip.race at oracle.com> wrote:
> I think the graphics code mostly if not always, guards those printlns with a check for
> a debugging flag. Unless used in a similar manner, the logging API carries overhead.
> There was a fix in JDK 7 to eliminate dependency on logging from AWT/2D/Swing.
> In part that was because of modularisation .. I don't know the full story on why
> that mattered.
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6879044 :
> Eliminate the dependency on logging from the AWT/2D/Swing classes
>
> -phil.
>
> On 5/8/2012 8:28 AM, Kevin Rushforth wrote:
>> This would certainly make everyone's life easier.
>>
>> In any case, library code should never write debug/warning/error meesages to System.out / stdout (and yes, I know that some of the graphics currently does). Best is to use logging where possible for the reasons Richard mentioned, and System.err / stderr where not.
>>
>> -- Kevin
>>
>>
>> Richard Bair wrote:
>>> 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