>
> > I think that overall, you'd find it more interesting to use the
> Logger class
>
> In all my ~370 places? :-)
NB has an awesome find/replace (in project) funciton :) then it's easy
to refactor...
>
> I debugged NB and System.out is a TopLogging$LgStream.
> And the code does this:
>
> if (!(System.err instanceof LgStream)) {
> System.setErr(new LgStream(Logger.getLogger("stderr")));
> // NOI18N
> if (DEBUG != null) DEBUG.println("initializing stderr");
> // NOI18N
> }
> if (!(System.out instanceof LgStream)) {
> System.setOut(new LgStream(Logger.getLogger("stderr")));
> // NOI18N
> if (DEBUG != null) DEBUG.println("initializing stdout");
> // NOI18N
> }
>
> so it's not fair to compare to Java it seems.
I think this is the code that NB use for log messages in the graphical
log console, you are in an IDE, it is active by default!
>
> I needed to know how it got there so I turned on logging ... except
> that logging
> comes out in spurts and I can't quite trust it.
if you want to debug your application into an IDE you can use directly
the IDE debugger instead of the printfs.... or the awesome NB profiler
to detect your hang, or JMX, Jconsole etc..
but if you prefer real-time logs for debbugging then is better to debug
manually into a separate jvm, without the IDE overhead...
"you cannot have your cake and eat it"
the old fashioned java -jar command can help...
Best regards,
Stefano.
Ivan Soleimanipour ha scritto:
>
> > I think that overall, you'd find it more interesting to use the
> Logger class
>
> In all my ~370 places? :-)
>
> My logger predates the use of the logger class in NB.
> I've been meaning to put an adapter in place ... I guess now is the time.
>
> But then ...
>
>
>>> Who would be doing this buffering?
>>
>> Just part of Java, observable in any hello-world app.
>>
>
> I debugged NB and System.out is a TopLogging$LgStream.
> And the code does this:
>
> if (!(System.err instanceof LgStream)) {
> System.setErr(new LgStream(Logger.getLogger("stderr")));
> // NOI18N
> if (DEBUG != null) DEBUG.println("initializing stderr");
> // NOI18N
> }
> if (!(System.out instanceof LgStream)) {
> System.setOut(new LgStream(Logger.getLogger("stderr")));
> // NOI18N
> if (DEBUG != null) DEBUG.println("initializing stdout");
> // NOI18N
> }
>
> so it's not fair to compare to Java it seems.
>
> Not that regular Java is that predictable in it's behaviour either.
>
> There is this thing called auto-flush. Apparenly the default
> System.out has it set to true, despite
> some web hits stating the contrary. Then the implementation of
> PrintStream is such that it
> sometimes even flushes with autoFlush turned off.
>
>
>>> Well then use System.err.
>
> Based on the above it looks like System.err isn't going to fare any
> better than System.out.
>
>> There is always OutputStream.flush() to help encourage things to go
>> out the other end.
>
> And LgFlush does all kinds of funky stuff with flush():
>
> flush.schedule(0);
> flush.waitFinished(500);
>
>
> So ... I'm skeptical.
>
> The situation I'm in is that I've got a wedged EDT but it looks as if
> some of the logging messages
> didn't make it out the door. I.e. the state I should be in according
> to the log doesn't
> match the stack trace.
> Would EDT be playing a role in flushing timers? (even though the above
> schedule() goes to an RP).
>
>
>