Sorry… what exactly is in this can again? by Paul Jerry, on Flickr
This is the most common thing you will see in an ATG Java class.
public class Foo extends GenericService
However 90% of the time it is extending GenericService so that the class has access to ATG’s logging capabilities.
This is overkill. The GenericService is much more than a logging service. As its name suggests it is meant to be extended by services, typically globally scoped. The main reason to extend GenericService is to get access to methods for controlling the service like doStartService
and doStopService
.
If you just want logging instead extend ApplicationLoggingImpl. It’s lighter weight and it’s clear why you are extending it. The only caveat is you have to remember to set the loggingIdentifier property in the properties file. For example:
# /betweengo/Foo $class=com.betweengo.Foo loggingIdentifier=betweengo.Foo
Another advantage of using ApplicationLoggingImpl is that the source is available in DAS/src/Java in the ATG installation unlike with GenericService.
Hopefully some people will read this post and on my next consulting project I won’t see such egregious uses of GenericService.