Over a million developers have joined DZone.

What I'm Missing in JavaFX 1.2 ;-)

· Java Zone

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

OK, tons of new things in JavaFX 1.2, but of course we developers always want more! I'm not asking for major stuff right now, as I understand that the effort behind JavaFX is huge. But there's really a small thing, that I realize is missing right now: support for logging.

Of course I'm not talking of the desktop profile: you can use anything you want, from java.util.logging, to log4j or SLF4J. I'm talking of the mobile profile, where we don't have anything.

And, of course, you can write your own, and would be pretty simple. But look at this:

def x = 3;
logger.fine("x = {x}");

The problem is about performance. Even though the "fine" logging level is disabled, the JavaFX compiler will always first build the string parameter, converting x to a string, putting into the template according to the braces placeholder and then call the method, where it will be ignored. In contrast, SLF4J approach is smarter since when you write:

int x = 3;
logger.debug("x = {}", x);

you don't have any string manipulation before calling the method; instead, it is SFL4J code that inspects the string template and replaces the braces placeholder. Of course, only if the debug level is enabled.

Clearly, this is really important in the mobile profile, where every single piece of performance is needed; and polluting the code with "if (debugLevel) ..." is even worse than in Java, since JavaFX is so concise.

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}