Question
· Aug 20, 2020

Class changes not executing

We are using Ensemble and I added some debug logging that writes to a global and recompiled the class in Studio. However, when we send messages, the global is not populated. I have recompiled, removing the checkmark to keep the generated code so that there is only one .INT file and I verified that the code is present in the .INT file. 

My question is, do we need to stop and restart the Ensemble production in order for these changes to take effect? Do I need to stop and restart the business operation that calls this piece of code? Is there something else I may have missed?

Below is the code segment, with new lines added marked in red.

Set msg = "Writing ADT, " _ me _ ", CareTracker."
Set ^CTADTCHECK($i(^CTADTCHECK),"Before Get package version") = msg

Set PackageVersion = ##class(Ens.Director).GetCurrProductionSettingValue("CareTracker Release",.tSC)
Set ^CTADTCHECK($i(^CTADTCHECK),"PackageVersion")= PackageVersion
Set beginTime = $ZH
Set tSC = dnADT.SaveToCareTrackerImportControl(dnPI,PackageVersion)
Set finishTime = $ZH
Set ^CTADTCHECK($i(^CTADTCHECK),"SaveToCareTrackerImportControl Result")=tSC
Set ^CTADTCHECK($i(^CTADTCHECK),"Elapsed Time") = finishTime-beginTime

Set dotNetError = dnADT.getuLastError()
Set ^CTADTCHECK($i(^CTADTCHECK),"DotNet Last Error") = dotNetError

When I zwrite the ^CTADTCHECK global, nothing is returned. 

Thanks in advance for any tips regarding this process.

Discussion (6)0
Log in or sign up to continue

/// This is a nice little debugging class<BR><BR>
/// All of my classes have an Include statement in them<BR><BR>
/// 
/// Include ExampleInc<BR><BR>
/// 
/// Then the Include Routine Example.inc has the following #define in it<BR><BR>
/// 
/// #define DebugLog(%s1,%s2,%s3) do ##class(Example.Debug.Logging).CreateDebugLog($classname(),%s1,%s2,%s3)<BR><BR>
/// 
/// Then in your code you can add calls to the Debug Logger as follows:<BR><BR>
/// 
/// $$$DebugLog("MyKey","This is my Debug Message",.dSC)<BR><BR>
/// 
/// To enable Debug Logging execute the following code in the namespace where your production is running<BR><BR>
/// 
/// do ##class(Example.Debug.Logging).DebuggingOnOff(1)<BR>
Class Example.Debug.Logging Extends %Persistent
{
Property CreateTS As %TimeStamp [ InitialExpression = {$zdt($now(),3,1,6)} ];
Property ClassName As %String(MAXLEN = 150);
Property Username As %String [ Required ];
Property Key As %String(MAXLEN = 100) [ Required ];
Property Message As %String(MAXLEN = 3641144, TRUNCATE = 1);
Index CDT On CreateTS;
Index CN On ClassName;
Index UN On Username;
Index K1 On Key;
ClassMethod CreateDebugLog(pClassName As %String = "", pKey As %String = "", pMessage As %String(MAXLEN=3641144,TRUNCATE=1), ByRef pStatus As %Status)
{
               set pStatus=$$$OK
               try {
                              // You might want to put a check in here to test whether you want to create a debug log
                              // So if you port the code to Production you can leave the debug calls in your code but
                              // turn off debugging
                              if '(+$get(^Example.Debugging)) quit
                              set obj=##class(EMCI.Debug.Logging).%New()
               set obj.ClassName=pClassName,obj.Key=pKey,obj.Message=pMessage,obj.Username=$username
                              set pStatus=obj.%Save() if 'pStatus quit
               }
               catch ex {
                              set pStatus=ex.AsStatus()
               }
               quit
}
ClassMethod DebuggingOnOff(pOnOff As %Boolean)
{
               set ^Example.Debugging=pOnOff
}
ClassMethod PurgeDebugLog(pNumberOfDays As %Integer = 30, ByRef pRowCount As %Integer) As %Status
{
               set tSC=$$$OK,pRowCount=0
               try {
                              set date=$zdt($h-pNumberOfDays,3),id=""
                              for {
                                             set date=$o(^Example.Debug.LoggingI("CDT",date),-1) quit:date=""
                                             for {
                                                            set id=$o(^Example.Debug.LoggingI("CDT",date,id)) quit:id=""
                                                            set tSC=##class(Example.Degug.Logging).%DeleteId(id)
                                                            if 'tSC {!,"Unable to delete Debug Log with ID: "_id set tSC=$$$OK Continue}
                                                            else {set pRowCount=pRowCount+1}
                                             }             
                              }
               }
               catch ex {
                              set tSC=ex.AsStatus()
               }
               quit tSC
}

}