Tuesday, February 18, 2014

Why do we declare Loggers static final?

  • private - so that no other class can hijack your logger
  • static - so there is only one logger instance per class, also avoiding attempts to serialize loggers
  • final - no need to change the logger over the lifetime of the class

No comments:

Post a Comment