The main interface into the tracing API is through an instance of the org.apache.log4j.Logger class. The infrastructure provides a number of named instances which match the categories described in Logging Hierarchy. The top level category is accessed through curam.util.resources.Trace.kTopLevelLogger as shown in Usage.
curam.util.type.DateTime timeNow; timeNow = curam.util.type.DateTime.getCurrentDateTime(); curam.util.resources.Trace.kTopLevelLogger.info( "This function was called at "); curam.util.resources.Trace.kTopLevelLogger.info(timeNow);
It should be noted that the above code produces two trace records. This will not be easily visible if log4j is configured to use a flat file or the console. However if a log4j viewer is used then the two trace records will result in a needless entry which will complicate the view without any added benefit. As such it is recommended that trace statements which contain logically dependent data are performed in a single call.
A formatted textual representation of a Cúram struct class object may be obtained through a call to the class curam.util.resources.Trace.objectAsTraceString call. For example:
curam.util.struct.ProcessNameKey someKey = new curam.util.struct.ProcessNameKey; someKey.processName="someValue"; curam.util.resources.Trace.kTopLevelLogger.info("DEBUG\n"); curam.util.resources.Trace.kTopLevelLogger.info( curam.util.resources.Trace.objectAsTraceString(someKey));