In some cases, you need logging for classes that are not instantiated by Nucleus, such as a servlet class created by the Web container, a static utility class that has no instances, or a light-weight class that has many instances, which don’t each need their own ApplicationLogging instances. In this case, you can use the ClassLoggingFactory to create a logger. An ApplicationLogging logger created by ClassLoggingFactory is shared by all instances of that class, and appears in Nucleus under the /atg/dynamo/service/logging/ClassLoggingFactory named for the class that created it. So, for example, if you had the following class:

package my.lovely;
import atg.nucleus.logging.*;

public class NonNucleus {
  ApplicationLogging mLogging =
    ClassLoggingFactory.getFactory().getLoggerForClass(NonNucleus.class);
}

Then an ApplicationLogging instance would appear in Nucleus as:

/atg/dynamo/service/logging/ClassLoggingFactory/my.lovely.NonNucleus

This allows you to turn logging on and off at runtime. Note that the component appearing in Nucleus is just the ApplicationLogging logger, and not the class (or instance) itself.

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 <DYNAMO_HOME>/atg/dynamo/service/logging/ClassLoggingFactory/my.lovely.NonNucleus.properties with the contents:

$class=atg.nucleus.logging.ApplicationLoggingImpl
loggingDebug=true

This turns on loggingDebug for our example NonNucleus class when the application starts up.

 
loading table of contents...