RFR: JDK-8005263: Logging APIs takes Supplier<String> for message

Zhong Yu zhong.j.yu at gmail.com
Fri Dec 21 17:09:28 UTC 2012

Question: why not delay the evaluation of the message even further,
until LogRecord.getMessage() is invoked? Since a logger might be
enabled for the level, but the handler is not, so the message is not
really logged. Or is that considered uncommon?

On Fri, Dec 21, 2012 at 12:28 AM, Henry Jen <henry.jen at oracle.com> wrote:
> Hi,
> This patch adds a couple APIs to java.util.logging.Logger so that
> construction of log messages only occurs when it is actually to be
> logged by using Supplier<String> instead of String.
> Since the idea is to avoid unnecessary construction of log messages,
> thus APIs imply formatting are not provided. Thus all forms of logrb and
> log with Parameters are not included.
> log with Throwable are named to be logEx or logpEx to avoid null
> ambiguous as it seems like it's quite common usage with
> logger.log(level, null, thrown)
> Specdiff and webrev can be found at following,
> http://cr.openjdk.java.net/~henryjen/ccc/8005263.0/specdiff/diff.html
> http://cr.openjdk.java.net/~henryjen/ccc/8005263.0/webrev/
> Cheers,
> Henry

More information about the core-libs-dev mailing list