A treasure trove of utilities and standard objects that should be used: and many others; this is a good place for a developer to browse.

Debug Capture Mechanism

Debug Class Model

Util Debug Model

 

Configuring Debug Capturing Properties

The file that contains the configuration information is Windchill\codebase\debug.properties.  The file contains descriptions for the syntax of entries and examples of each. The types of configuration entries are as follows:

Initializing a Class to use Debug Capturing

    public class SomeClass {
        public static final boolean DEBUG = DebugProperties.isDebugOn( CLASSNAME );
        private static final DebugWriter LOG = ( DEBUG ? DebugProperties.getWriter( CLASSNAME ) : null );
        ...

Capturing TRACE Information

    public void step1( String[] args ) {
        //##begin step1%3945723701D4.body preserve=yes
         if ( DEBUG && DebugProperties.isTrace( this ) ) {
             Object[] dargs = { args };
            LOG.enter( CLASSNAME, "step1(String[])", dargs );
         }
         step2()
         if ( DEBUG && DebugProperties.isTrace( this ) )
          LOG.exit( CLASSNAME , " step1(String[])" );
         //##end step1%3945723701D4.body
    }
    public boolean step2() {
        //##begin step2%3945729A030D.body preserve=yes
        if ( DEBUG&& DebugProperties.isTrace( this ) )
          LOG.enter( CLASSNAME, "step2()" );
        boolean retVal = step3( 3, this ) != null;
        if ( DEBUG && DebugProperties.isTrace( this ) )
          LOG.exit( CLASSNAME , "step2()", retVal );
        return retVal;
        //##end step2%3945729A030D.body
    }
    public Object step3( int primitive, Object object ) {
        //##begin step3%3945726A038A.body preserve=yes
        if ( DEBUG && DebugProperties.isTrace( this ) ) {
            Object[] dargs = { new Integer( primitive ), object };
           LOG.enter( CLASSNAME, "step3(int,Object)", dargs );
        }
        Object retVal = object;
        if ( DEBUG && DebugProperties.isTrace( this ) )
          LOG.exit( CLASSNAME, "step3(int,Object)", retVal );
        return retVal;
        //##end step3%3945726A038A.body
    }

Capturing Other Debug Information

    public void testData() {
        //##begin testData%39457382002E.body preserve=yes
        if ( DEBUG && DebugProperties.isData( this ) )
          LOG.identify( this ); // report the identity of an object
        if ( DEBUG && DebugProperties.isData( this ) )
          LOG.dump( this );  // report the complete state of an object
        //##end testData%39457382002E.body
    }

   public void testException() {

        //##begin testException%39457304035B.body preserve=yes
        Throwable thown = new WTRuntimeException( "Test brief runtime exception report" );
        if ( DEBUG && DebugProperties.isException( this ) )
          LOG.exception( thown );
        thown = new WTException( RESOURCE, wt.util.utilResource.MALFORMED_MIME, null );
        if ( DEBUG && DebugProperties.isException( this ) )
          LOG.exception( thown );
        //##end testException%39457304035B.body
    }

   public void testStackTrace() {

        //##begin testStackTrace%3945739F034B.body preserve=yes
        if ( DEBUG && DebugProperties.isStackTrace( this ) )
           LOG.printStackTrace( "Test printStackTrace" );
        //##end testStackTrace%3945739F034B.body
    }

   public void testReport() {

        //##begin testReport%394573880280.body preserve=yes
        if ( DEBUG && DebugProperties.isReport( this ) )
          LOG.report( "Test general report API." );
        //##end testReport%394573880280.body
    }

Adjusting Debug Configuration On The Fly

    public void setConfig1() {
 
        DebugProperties.setFlag( DebugFlag.TRACE, CLASSNAME, DebugType.CLASS, "", true );
    }

   public void setConfig2() {

 
        DebugProperties.setFlag( DebugFlag.DATA, CLASSNAME, DebugType.CLASS, "", true );
        DebugProperties.setFlag( DebugFlag.EXCEPTION, "wt.util", DebugType.PACKAGE, "", true );
        DebugProperties.setFlag( DebugFlag.REPORT, "wt.util", DebugType.PACKAGE_HIERARCHY, "", true );
        DebugProperties.setFlag( DebugFlag.STACK_TRACE, "<<subsystem>>util", DebugType.GROUP, "", true );
    }

 
    public void setConfig3() {    // set all flags on, with one call
        DebugProperties.setFlag( DebugFlag.ALL, CLASSNAME, DebugType.CLASS, "", true );
    }