#1739 Printing stacktrace to STDOUT is not very user friendly

saltnlight5 Wed 21 Dec 2011

Hi,

In quiet a few places (both Fantom and Java) I see things like this when looking at the SDK source (eg: see Actor.java):

catch (Throwable e)
{
  e.printStackTrace();
}

So what happen if I were to use the library and intend to use a file logger? I much prefer a library to throw an exception, or in case it can't, then use a logger object instead of printing to STDOUT. At least the user have a chance to redirect output to anywhere they prefer. Is this not a practice with Fantom?

brian Wed 21 Dec 2011

There may be places especially in bootstrap code where we do that just for internal debugging. But as a general rule, anything that might be expected to happen in a normal runtime goes thru the sys::Log API. You can install your own Log handler there, see util::FileLogger if you want to setup logging to file.

saltnlight5 Wed 21 Dec 2011

Hi Brian,

My point is the above is found in Actor.java, and I don't think that's bootstrap code, right?

ahhatem Wed 21 Dec 2011

The reason might be that the "concurrency" pod was originally part of the sys pod..

brian Wed 21 Dec 2011

Those are internal only exceptions. Although might be one case where if your coalescing function could raise an exception it just gets logged to stdout - but that code is so deep into the concurrency model that any callback out to a logger would be highly dangerous.

Login or Signup to reply.