Can’t you just deprecate java.util.logging?

While I am half kidding, can someone explain why it doesn’t use a ServiceLoader 
to locate the LogManager implementation?

Ralph

> On Nov 10, 2017, at 9:04 AM, Daniel Fuchs <daniel.fu...@oracle.com> wrote:
> 
> Hi Jason,
> 
> I have done a few tests with JDK 8 & 7.
> 
> I have created custom handlers and added some
> debug traces in their constructors and debug methods.
> 
> Then I have added these two lines to my logging.properties:
> 
> handlers = custom.Handler
> .handlers = custom.DotHandler
> 
> What I see is this:
> 
> - the first time the configuration is read, two handlers
>  are added to the root logger:
>  - an instance of DotHandler (first), then an instance
>    of Handler (second).
> 
> Then if you call LogManager.readConfiguration() again,
> both handlers are closed, and this time only one
> instance of Handler is added to the root logger.
> No instance of DotHandler is added.
> From now on the property is ignored.
> 
> This is because the root logger is a special beast:
> it will not be removed (like all other loggers) when
> LogManager.readConfiguration() is called.
> 
> And as it happens, handlers are added to loggers
> when the loggers are added to the LogManager.
> As it happens, the ".handlers" property is only parsed
> and read when the root logger is added to the LogManager,
> and thus only once.
> 
> The "handlers" property on the other hand is parsed
> every time LogManager.readConfiguration() is called.
> 
> Given that, I suspect we should deprecate the use of
> ".handlers" for the root logger, as it appears that
> it has never worked properly. I could work on a patch
> for 10 (possibly backport it to 9 update) to preserve
> the strange behavior of 7 & 8, but is it worth it?
> 
> What are your thoughts?
> 
> best regards,
> 
> -- daniel
> 
> 
> 
> 
> On 09/11/2017 19:50, Jason Mehrens wrote:
>> Daniel,
>> I would assume you would fix since it is advertised as a feature over here: 
>> https://docs.oracle.com/javase/1.5.0/docs/guide/logging/changes.html
>> If it helps, I've dug up a lot of the history on this over here a while back:
>> https://stackoverflow.com/questions/36726431/in-a-java-util-logging-logging-properties-file-whats-the-difference-between-h
>> I've updated that to include the links to this new issue.  Now that I've 
>> linked this message thread to that message thread that should crash the 
>> internet. :)
>> Jason
>> ________________________________________
>> From: core-libs-dev <core-libs-dev-boun...@openjdk.java.net> on behalf of 
>> Daniel Fuchs <daniel.fu...@oracle.com>
>> Sent: Thursday, November 9, 2017 1:29 PM
>> To: mandy chung
>> Cc: core-libs-dev@openjdk.java.net
>> Subject: Re: Change in properties for logging: deliberate?
>> On 09/11/2017 19:16, mandy chung wrote:
>>> Daniel - we should add this known issue in the release note and document
>>> the workaround.
>> Hi Mandy,
>> Right, it either need to be fixed, or documented in the release
>> notes. Let me first have a look at the issue though.
>> best regards,
>> -- daniel
> 
> 


Reply via email to