Logging in Petstore 2.0 ?
Hi,
In the petstore 2.0 early access https://blueprints.dev.java.net/petstore/index.html, I was looking at the logging. Since the early access code is getting cleaned up and refactored, what conventions and practices should be used for logging?
For example, right now I notice that a lot of code is adding this method
/**
* Method getLogger
* @return Logger - logger for the NodeAgent
*/
public Logger getLogger() {
if (_logger == null) {
_logger=PetstoreUtil.getBaseLogger();
}
return _logger;
}
Its tricky to cut and paste that methofdo nto classes that need logging, so instead, should the petstore logging be reafctored to
1) Inheritence? Make a class PSBaseLogger.java or some utility class with this method and just have the classes that use it *extend* PSBaseLogger so they each have that logger method and so you dont have to paste it everywhere you use the logger?
2) Use utility method? Make a class PSBaseLogger.java or some utility class with this method and just have each method use it. Maybe have a static method to make it easy to use everywhere?
3) other?
What other considerations should be looked at for refactoring the logging?
hth,
Sean

