LockieR :
In Java is it better to have an object, such as a logger, declared as
private static final Logger logger = LoggerFactory.getLogger();
or
private static final Logger LOGGER = LoggerFactory.getLogger();
I think that the first option is better, becuase when you call methods on it such as
logger.info("Some information...");
it looks better and is more readable, but I'm not sure what best practice is?
The other option is to declare the object as
private final Logger logger = LoggerFactory.getLogger();
but I thought that in Java if you can declare something as static
then you should.
Raghu Bhagwat :
Generally constants are declared in uppercase letters. Again it depends on project preference. This may be duplicate of thread Java naming convention for static final variables.
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=329762&siteId=1