Can't get Platform Logging to work
daniel.fuchs at oracle.com
Fri Aug 19 15:16:30 UTC 2016
Log messages emitted by the JVM are not emitted through
the System.Logger API. JEP 264 is a pure Java API which
aims at replacing the sun.util.logging.PlatformLogger
I believe what you are looking for is JEP 158
Unified JVM Logging 
On 19/08/16 16:05, Nicolai Parlog wrote:
> I'm trying out JEP 264: Platform Logging API and Service but can't get
> it to work (or misunderstood something).
> My understanding is that the JVM should use the provided LoggerFinder to
> log its own messages. So when I start with "-verbose:gc" I expected the
> message "Using G1" to go through my logger implementation - but it doesn't.
> I've set up a demo project, in which I'm creating a modules `logger`,
> which provides `LoggerFinder`, and `app`, which holds the started
> application. I launch with:
> java -verbose:gc -mp out/mods -m org.codefx.demo.java9.app
> The messages I send from the app module go through my logger, so the
> service module gets picked up. But the G1 message doesn't. :( I noticed
> that the docs say this:
>> First it finds any custom LoggerFinder provider using the
> ServiceLoader facility with the system class loader.
> Do I have to do anything differently to make my service available to the
> system class loader?
> On a tangent, I also wondered what would be the preferred way to log
> from inside my code. Should I use System::getLogger directly?
> Logger logger = System.getLogger("Application");
> logger.log(Level.INFO, "Hello, World!");
> so long ... Nicolai
More information about the core-libs-dev