AndroMDA Developer Debugging

This document provides guidelines on debugging the internals of AndroMDA. Logging is managed by AndroMDALogger .

Overriding log4j settings

Too override the default log4j settings:.

  • Create a file log4j.xml
  • Add the loggingConfigurationUri property to your AndroMDA configuration . For example:
    <property name="loggingConfigurationUri">file:/some_location/log4j.xml</property>
    .
  • Modify as required. For more information consult the log4j documentation or this useful tutorial . For pattern settings see PatternLayout javadoc. The sample one above turns off INFO messages and limits others to WARN apart from the ejb cartridge which is set to DEBUG.

Log4J Categories

Category Usage
AndroMDA General Information messages
namespaces Information messages for namespaces.
AndroMDA:NAMESPACE_NAME Information messages for the specific namespace.
org.andromda.namespaces.CARTRIDGE Debug messages for the specific cartridge.

Core Debugging

TBC

Cartridge Debugging

The base class, MetaFacadeBase of Facade logic classes contains an instance variable logger. This logger will have been initialized to use the appropriate namespace category for the cartridge which contains this class. When using the debug calls the isDebugEnabled method should be used to reduce the overhead of debug calls

if
(logger.isDebugEnabled()) { logger.debug(
"A debug message '
" + metaObject + "
,
" + context + "
'"
); }
The logger instance variable is not initialized until after the object is constructed and therefore not available in the constructor. To circumvent this the following code can be employed:
Logger namespaceLogger = AndroMDALogger.getNamespaceLogger(
"ejb"
);
if
(namespaceLogger.isDebugEnabled()) { namespaceLogger.warn(
"EJBEntityFacadeLogicImpl("
+ metaObject +
","
+ context +
")"
); }
Replacing "ejb" with the appropriate cartridge/namespace name.