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 do not 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/
named for the class that created it. So, for example, given the following class:
package my.lovely; import atg.nucleus.logging.*; public class NonNucleus { ApplicationLogging mLogging = ClassLoggingFactory.getFactory().getLoggerForClass(NonNucleus.class); }
an ApplicationLogging
instance appears in Nucleus as follows:
/atg/dynamo/service/logging/ClassLoggingFactory/my.lovely.NonNucleus
This lets you 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. Given the previous example, you can create a properties file <DYNAMO_HOME>/atg/dynamo/service/logging/ClassLoggingFactory/
with the following content:
my.lovely.NonNucleus.properties
$class=atg.nucleus.logging.ApplicationLoggingImpl loggingDebug=true
This turns on loggingDebug
for the example NonNucleus
class when the application starts up.