Change in properties for logging: deliberate?

Jeremy Manson jeremymanson at google.com
Thu Nov 9 01:09:50 UTC 2017


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