I'm trying to recieve the logger for my class:
public static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(this);
But using "this" there causes "Cannot use this in a static context" error.
Anyone know how to fix this?
EDIT: I must be able to access the logger from all classes in my program, so it must be public.
Notice I changed modifier from public
to private
:
public class FooBar {
private static final Logger log = Logger.getLogger(FooBar.class);
//or (if you are using java.util.logging):
private static final Logger log = Logger.getLogger(FooBar.class.getName());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With