Community
Showing results for 
Search instead for 
Do you mean 

Sage ACT! Event Logging (SDK Users) (New)

by Administrator ‎05-05-2011 04:59 PM - edited ‎05-05-2011 05:03 PM (6,531 Views)

Over the course of my time working with Sage ACT! and it's SDK customer base, one of the most frequently asked questions I get is "what event(s) should I register for?"

Others questions are of a similar vein, such as "What order can I expect these events to fire?"; or "What does this event do exactly?" Therefore I decided to clear up as much

of this confusion as I could and make it much easier for SDK users to actually see what events are firing and integrate this into the built in Sage ACT! logging API that many SDK consumers are familiar with.

 

First let's take a look at how to enable logging for events in the Sage ACT! 2012 release:

 

Steps:

            #1. Locate "Actsage.exe.config" which is in your install directory (Default: "C:\program files\act\act for windows")

            #2. Open the  file using notepad.exe or some other text editor (not MS word though)

            #3. Go toward the bottom of the file to the section for logging for <system.diagnostics> (See Below)

 

  <system.diagnostics>

    <switches>

      <!--Logging Levels: value =

          0 – Off

          1 – Error

          2 – Warning

          3 – Info

          4 – Verbose

      -->

 

      <!-- New High Level Log Categories - beginning with ACT! 12.1 -->

      <add name="ACTCommonSwitch" value="1"/>

      <add name="ACTFrameworkSwitch" value="1"/>

      <add name="ACTApplicationSwitch" value="1"/>

      <add name="ACTEventSwitch" value="1"/>

 

      <!-- The categories below are not used in new code, but still exist in legacy code

           (i.e., you may need to set the logging levels for both the old (below)

           and the new (above) categories for now -->

      <add name="ACTCoreSwitch" value="1" />

      <add name="ACTUISwitch" value="1" />

      <add name="ACTIntegrationSwitch" value="1"/>

      <add name="ACTSecuritySwitch" value="1" />

      <add name="ACTSyncSwitch" value="1" />

      <add name="ACTSyncSetupSwitch" value="1" />

      <add name="ACTDesignTimeSwitch" value="1" />

      <add name="ACTExtendedSwitch" value="0" />

      <add name="ACTReportingSwitch" value="1" />

      <add name="ACTGDISnapshotSwitch" value="1" />

    </switches>

    <trace autoflush="true">

      <listeners>

        <add name="ACTTraceLogger" type="Act.Shared.Diagnostics.TraceLogger, Act.Shared.Diagnostics, Version=14.0.284.0, Culture=neutral, PublicKeyToken=ebf6b2ff4d0a08aa" />

      </listeners>

    </trace>

  </system.diagnostics>

 

            #4. Change the line for ACTEventSwitch from "1" to "4"

 

Now you will have the exposed SDK events (or as many as I felt relevent by release) show up in the ACTLOG.xml file - most people just run "Logviewer.exe" from their install directory AFTER the exit ACT! to get results.

 

Let's take a look at a sample that I just made - this one demonstrates starting ACT! and going to the default view :

 

9:46:18.703 UI Event: Startup at Act.UI.ActApplication.OnStartup()

9:46:26.156 UI Event: Open at Act.UI.ActApplication.OnOpen()

9:46:26.172 UI Event: CancelLogoff at Act.UI.ActApplication.OnCancelLogoff()

9:46:26.750 UI Event: BeforeLogon at Act.UI.ActApplication.OnBeforeLogon()

9:46:28.389 UI Event: OnCurrentContactListChanging at Act.UI.ActApplication.OnCurrentContactListChanging()

9:46:28.436 UI Event: CurrentContactListChangeda t Act.UI.ActApplication.OnCurrentContactListChanged()

9:46:28.764 UI Event: AfterLogon at Act.UI.ActApplication.OnAfterLogon()

9:46:29.795 UI Event: ViewLoaded at Act.UI.ActApplication.OnViewLoaded()

9:46:29.811 UI Event: CurrentViewChanged at Act.UI.ActApplication.OnCurrentViewChanged()

9:46:29.889 UI Event: CurrentViewLoaded at Act.UI.ActApplication.OnCurrentViewLoaded()

9:46:50.570 UI Event: OnCurrentContactChanging at Act.UI.ActApplication.OnCurrentContactChanging()

9:46:50.570 UI Event: CurrentContactChanged at Act.UI.ActApplication.OnCurrentContactChanged()

 

Note: Obviously this is currently pretty raw, but I plan on going back and trying to add more detailed information into the log message, but the descriptions for these are shown in Visual Studios' autocomplete feature.

 

For those of you who are familiar with writing plugins, many of these events (delegates actually), should be quite familiar.  The event most people are familiar with is the "OnViewLoaded".

Why this event so important?  It's the first event after the user is logged in AFTER 1st view has been loaded.  It's the ideal place to add a menu item, custom tab, etc.

 

I hope this gives you a primer on the way you can use the logging system in order to better understand what events are important to you and what order they are triggered.

 

Brian

Comments
by mikeclarkusa
on ‎10-10-2014 06:55 AM

Brian,

Thanks for this excellent instruction.

 

I am using ACT! Pro 2013 and notice the instruction    <add name="ACTEventSwitch" value="1"/>  is not included in my ActSage.exe.config, neither in the High Level Categories as you show above, nor in the list of legacy codes below that list.

 

Do you know if this is deliberate on Sage's part? Or an error?

 

Should I add the instruction?

 

Thanks,

- Mike

Labels