I am using enum singleton, but logging is difficult. It:
public enum Foo {
INSTANCE;
private final Logger log = Logger.getLogger(Foo.class.getName());
...
}
The logger is created in such a way that I would create a logger for a regular Java class, but of course I get the following error:
Foo.java: illegal reference to static field from initializer
Is there an equivalent way to enter enum enumeration lists?
source
share