RFR: JDK-8046565: Platform Logger API and Service (original) (raw)
Mandy Chung mandy.chung at oracle.com
Fri Oct 16 18:47:37 UTC 2015
- Previous message: RFR: JDK-8046565: Platform Logger API and Service
- Next message: RFC: draft API for JEP 269 Convenience Collection Factories
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 16, 2015, at 4:16 AM, Stephen Colebourne <scolebourne at joda.org> wrote:
On 15 October 2015 at 17:31, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
I have a major concern that the class names 'Logger' and 'Level' duplicate those of java.util.logging. While they are inner classes as opposed to top level classes, both IntelliJ and Eclipse will find the inner class and top level class when typing "Logger". This will no doubt cause many users to import the wrong one. I propose that these classes are renamed to avoid this problem. The simplest would be to change them from inner classes to top level classes "System.Logger" -> "SystemLogger". Alternatively, they could stay as inner classes and be prefixed "System.Logger" -> "System.SysLogger" or "System.Logger" -> "System.BasicLogger".
After having worked with it for some time I find that using inner interfaces/classes for Logger and Level is not that bad. Certainly better than if it was a top-level class of the same name. It is fortunately rare that you need to use both (the System. and the j.u.l one) in the same class. It's hard to find a compelling new name though :-) Since I assume the purpose of these new Logger/Level interfaces is simplistic and primarily for the JDK's own use, a name that emphasises that would seem reasonable, hence BasicLogger/BasicLoggerLevel or similar.
I would typically type something like this before fixing the import: Logger logger = System.Logger(“foo”);
In this case, IDE should suggest the returned type (System.Logger in this case) as the first one in the import suggested list. It might not be too bad.
FWIW Logger is a simple name that people like :) There are 4 classes named Logger in the JDK and TestNG has another one (my project happened to have TestNG library included). I also like Logger than SystemLogger or BasicLogger.
Mandy
- Previous message: RFR: JDK-8046565: Platform Logger API and Service
- Next message: RFC: draft API for JEP 269 Convenience Collection Factories
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]