Enabling logging for a shared variable is a two-step process. First, you must enable logging and configure logging options in the Project Library Properties dialog box. You then can enable logging on the Logging page of the Shared Variable Properties dialog box when you create the shared variable. When you enable logging, the DSC Module logs all shared variables except those you configure not to be logged.
To enable logging programmatically, use the Logging:Enabled, Logging:Log Alarms and Events, and Logging:Log Data SharedVariableIO properties.