Question

What is the convention/tradition? Loggers in every class for completeness?

Was it helpful?

Solution

This is really opinion based, but for what it's worth I use loggers only when I need to log functionality for debugging/info/error purposes.

For example if your class has a set of properties and returns a collection of those properties you likely do not need to add a logger, but if you add methods to manipulate the data prior to returning the collection you may want to add a logger to expose the data during the manipulation phase.

That being said - its up to you to determine what needs to be logged. But I don't see a point in adding a logger if it's not going to be used...

OTHER TIPS

Don't over think it. When you realize that you have something you want to log in a class, add a logger. Until that point, you don't need a logger.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top