Oracle ATG Web Commerce includes an interface called atg.nucleus.logging.ApplicationLogging
that encapsulates the above concepts. It also includes a sample implementation of this interface named atg.nucleus.logging.ApplicationLoggingImpl
.
For each logging level, ApplicationLogging
defines the following methods:
public void setLoggingError (boolean loggingError); public boolean isLoggingError (); public void logError (String str); public void logError (Throwable t); public void logError (String str, Throwable t);
Similar methods are also defined for warning, info, and debug log levels.
ApplicationLoggingImpl
also includes the methods that define a component as a source of log events:
public void addLogListener (LogListener listener); public void removeLogListener (LogListener listener);
The ApplicationLogging
interface is meant to serve as a template for components that wish to follow Oracle ATG Web Commerce logging conventions. This is useful for developers that wish to subclass an existing component. If you know that the base component already implements ApplicationLogging
, you can follow the Oracle ATG Web Commerce conventions for sending logging messages in the subclass.
Components that are derived from GenericService
automatically inherit all of these behaviors because GenericService
implements ApplicationLogging
. Components that are unable to subclass GenericService
can also implement ApplicationLogging
. The source code for the sample implementation, located at <ATG10dir>/DAS/src/Java/atg/nucleus/logging/ApplicationLoggingImpl.java
, can be used as the template for such implementations.