On Fri, 10 Jul 2026 11:44:28 GMT, John Hendrikx <[email protected]> wrote:

>> modules/javafx.base/src/main/java/com/sun/javafx/binding/ListenerList.java 
>> line 178:
>> 
>>> 176:                  */
>>> 177: 
>>> 178:                 Logging.getLogger().warning(
>> 
>> rant: it's amazing that we reinvent the wheel all the time instead of making 
>> a good logging facade a part of java.
>> 
>> in this case, can the log output be disabled?  I suspect even when disabled, 
>> the `formatted()` will be called.
>> 
>> related: is `MessageFormat` a better choice for logging?
>
> These days (well since Java 9) there is a new facade that seems to be 
> preferred over JUL logging as it is easier to integrate: 
> `System.getLogger(loggerName)`
> 
> Also, I don't think we really reinvented the wheel here; we just made a 
> facade for unit testing specifically (as it is hard to hook into JUL logging 
> I think for this, given it is asynchronous). We could also directly get the 
> relevant JUL logger here and not go through the facade and the result would 
> be the same (just can't be unit tested as easily then).
> 
> I can surround this with a "is level warning" check, if you think it would be 
> a performance issue (this log shouldn't show up at all, and if it does, there 
> may be something seriously broken with your listeners that would have 
> resulted I think in a `StackOverflowError` in the system that this PR 
> replaces).
> 
> As I think this message should never appear in 99.99% of FX applications, I'm 
> not worried about the formatting overhead; and if it does appear, the correct 
> action would be to fix it, not ignore it.

Good question. There also is: 
[JDK-8200236](https://bugs.openjdk.org/browse/JDK-8200236).

The advantage: The System.Logger has a `log(Level level, Supplier<String> 
msgSupplier)` method. The `Supplier` is only 'used' when the log level matches.

And in general I don't think we should keep `PlatformLogger`, as also noted in 
the ticket.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1081#discussion_r3558644568

Reply via email to