[OpenJDK 2D-Dev] Fwd: Re: RFR : 8248802: Add log helper methods to FontUtilities.java

Daniel Fuchs daniel.fuchs at oracle.com
Tue Jul 14 15:39:49 UTC 2020


Hi Christoph,

Sorry - I'm not on 2d-dev - so please include me in cc: if you
reply to this mail. Also my apologies if I don't have the full
context of this discussion.

 > Unfortunately, PlatformLogger does not (yet?) offer public logging
 > methods taking suppliers.

I would suggest using System.Logger directly instead.
PlatformLogger delegates to System.Logger behind the scene,
and System.Logger has APIs that take suppliers:

https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/System.Logger.html

best regards

-- daniel

On 14/07/2020 16:03, Roger Riggs wrote:
> -------- Forwarded Message --------
> Subject: 	Re: [OpenJDK 2D-Dev] RFR : 8248802: Add log helper methods to 
> FontUtilities.java
> Date: 	Tue, 14 Jul 2020 14:22:50 +0000
> From: 	Langer, Christoph <christoph.langer at sap.com>
> To: 	Philip Race <philip.race at oracle.com>, Baesken, Matthias 
> <matthias.baesken at sap.com>
> CC: 	Peter Hull <peterhull90 at gmail.com>, Jayathirth D v 
> <JAYATHIRTH.D.V at oracle.com>, 2d-dev at openjdk.java.net 
> <2d-dev at openjdk.java.net>
> 
> 
> 
> Hi,
> 
> I guess it would make sense to offer logging methods that take a 
> supplier as input. That way we could pass String concatenations as 
> Lambdas that only evaluate when actually calling the logging.
> 
> Unfortunately, PlatformLogger does not (yet?) offer public logging 
> methods taking suppliers. Those should, however, be easy to implement, 
> leveraging already existing signatures of the logging Bridge such as 
> here: 
> https://github.com/openjdk/jdk/blob/195c45a0e11207e15c277e7671b2a82b8077c5fb/src/java.base/share/classes/sun/util/logging/PlatformLogger.java#L210
> 
> Furthermore, initialization of logging in FontUtilities looks a bit 
> awkward. I think the if (debugFonts) in line 117 is unnecessary and the 
> code of that block could be added to the block before (of line 107: if 
> (debugLevel != null && !debugLevel.equals("false"))). And you could also 
> remove the following imports there (line 29ff):
> 
> import java.io.BufferedReader;
> 
> import java.io.File;
> 
> import java.io.FileInputStream;
> 
> import java.io.InputStreamReader;
> 
> Best regards
> 
> Christoph
> 



More information about the 2d-dev mailing list