Which is the best way to declare logger variable in java

All upper-case variable names are IMO out because you really aren't declaring/defining a constant but a static variable. Uppercase names are more suitable for "constants". That said, I'd personally go with the first approach.

private static final Logger logger = Logger.getLogger(ServiceImpl.class);

I vote for 3

 private static final Logger LOGGER = Logger.getLogger(ServiceImpl.class);

It's final since you don't change it and it's in uppercase since it's a constant.

Tags:

Java

Logging