Tuesday, March 17, 2015

Add a Logger to Non Nucleus Classes (ATG Oracle Commerce)

There are some situations where you need to create a class that will not be a nucleus component, for example PropertyDescriptor Classes or Util classes used as TagLibs, or many other examples.

So you want to have a good logging for those classes, in order to log with them ATG provides a Nucleus Logger component that can help to achieve this.

This component can be found at /atg/dynamo/service/logging/ClassLoggingFactory

And Works as follows:

First you need to add an instance of this logger to your Class as Follows:

Once this is done, you can use it as regular logger:

The ClassLoggingFactor will create an entry for your class and you will be able to see this:


You will notice that loggingDebug and loggingError flags are present, is up to you when to turn them on Live.

You can turn on logging for ClassLoggingFactory client classes when your application starts up by creating a properties file at the appropriate location. In the above example one could create a properties file

/atg/dynamo/service/logging/ClassLoggingFactory/com.ocorp.MyClass.properties with the contents:

This can be found on ATG and is out there since ATG 2007 at minimum:


Post a Comment