[JDK 11] RFR: 8195096: Exception printed on console with custom LogManager on starting Apache Tomcat

Daniel Fuchs daniel.fuchs at oracle.com
Fri Jan 19 19:20:55 UTC 2018


Hi Jason,

I'm afraid the issue is more subtle than that.
".handler" has never been handled lazily - it was also eagerly
called in 8.

What changes is that in JDK 9, in ensureLogManagerInitialized(),
I moved the creation of the RootLogger just before calling
the call to readPrimordialConfiguration(), as that made
sure the RootLogger would be created and added to the
LoggerContext before the "global" logger.

This in turn has had the subtle side effect to cause the root logger
to be added to the LoggerContext earlier than before, during the
reset() call that readConfiguration() makes.

Which means that in JDK 9 when we returned from
readPrimordialConfiguration() then the RootLogger
was already present in the LoggerContext,
and when we later call addLogger(root), then
loadLoggerHandlers("", ".handler") was no longer called.

The sad truth is that we had absolutely no test with a configuration
setting the ".handlers" property. All our tests were using "handlers",
and so the subtle behavior change between 8 and 9 went completely
unnoticed. I wasn't even aware that setting ".handler" for the
root logger was (kind of) supported.

In JDK 10 I fixed that regression by forcing a call to
loadLoggerHandlers("", ".handler") just after reading the
primordial configuration and calling addLogger(), which is
restoring the behavior we had in 8 (or AFAICT very close to it).

best regards,

-- daniel

On 19/01/2018 16:51, Jason Mehrens wrote:
> Daniel,
> 
> Double check me on this but, I think I've found the source of why the error occurs on JDK9 and not JDK8.
> Inhttps://bugs.openjdk.java.net/browse/JDK-8191033  the new code should have been added to initializeGlobalHandlers.  That would make the read of ".handers" lazy and keep the read of "handlers" eager.
> 
> Jason



More information about the core-libs-dev mailing list