I am working on a project, and am currently working on implementing some logging with log4j and I was curious about how I should go about implementing the logs. The two implemen
Both make sense. It depends on your application.
I think that more often used practice is to have private logger for each class. This allows you to configure logging both per class and per package. Remember, that AbstractFoo
and Foo
may belong to different packages and probably you want to see logs from Foo
only.
Moreover always think twice if you want to write protected
field. It is not completely forbidden but a well known bad practice. It makes your code less readable and difficult to maintain.