Change in properties for logging: deliberate?

Daniel Fuchs daniel.fuchs at oracle.com
Thu Nov 9 15:09:56 UTC 2017


Sorry Jeremy,

I think I misread your issue.

The issue is that .handlers=X behaves differently than handlers=X
I'm afraid I might have introduced this regression with
https://bugs.openjdk.java.net/browse/JDK-8033661 :-(

The obvious workaround for now would be to use
handlers=
as documented in the logging.properties file.

For compatibility reasons then I think we unfortunately
must continue to support ".handlers" as well, if that
used to work in 8.

I logged https://bugs.openjdk.java.net/browse/JDK-8191033

best regards,

-- daniel


On 09/11/2017 12:36, Daniel Fuchs wrote:
> Hi Jeremy,
> 
> Which jdk version/distribution are you using?
> 
> I see .level = INFO in the jdk9/master sources:
> http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/java.logging/share/conf/logging.properties 
> 
> 
> There should be no changes WRT the default level between 8 and 9.
> 
> best regards,
> 
> -- daniel
> 
> On 09/11/2017 01:09, Jeremy Manson wrote:
>> Hey folks,
>>
>> I can't find reference to this in a relnote, so I thought I would 
>> ask.  If
>> we have the following files:
>>
>> logging.properties:
>>
>> # Set the level of the root logger
>> .level = INFO
>>
>> # Send the root logger's output to the console
>> .handlers = java.util.logging.ConsoleHandler
>>
>> Test.java:
>> public class Test {
>>    public static void main(String[] args) {
>>      java.util.logging.Logger.getAnonymousLogger().info("Hi!");
>>    }
>> }
>>
>> In Java 8, we will see console output, and in Java 9, we won't.
>>
>> # Java 8
>> $ java -Djava.util.logging.config.file=logging.properties Test
>> Nov 08, 2017 5:02:05 PM Test main
>> INFO: Hi!
>>
>> # Java 9
>> $ java -Djava.util.logging.config.file=logging.properties Test
>>
>>
>> I thought that, perhaps, a decision was made to have the empty string no
>> longer mean the root logger, so I took it off of .handlers:
>>
>> logging.properties:
>>
>> # Set the level of the root logger
>> .level = INFO
>>
>> # Send the root logger's output to the console
>> handlers = java.util.logging.ConsoleHandler
>>
>> Success in the sense that this got me output in Java 9.  However, .level
>> still seems to work; if I then have:
>>
>> # Set the level of the root logger
>> .level = WARNING
>>
>> # Send the root logger's output to the console
>> handlers = java.util.logging.ConsoleHandler
>>
>> it sets the root logger's level to WARNING.
>>
>> I don't see any of this in a relnote anywhere, and I don't see an obvious
>> bug about it anywhere.  There seem to have been a fair few changes to
>> java.util.logging in Java 9.  Was a documented decision made to have
>> .handlers stop meaning handlers on the root logger, but to allow 
>> .level to
>> continue meaning level on the root logger?  Or do I just have the 
>> wrong end
>> of the stick on this?
>>
>> Thanks!
>>
>> Jeremy
>>
> 



More information about the core-libs-dev mailing list