Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Historian SDK

Error Logging

The SDK supports logging client messages to the ArchestrA Logger on the computer where the SDK application is running. To log a message, you need to create an instance of the HistorianAccess class or use an already created instance and call its LogMessage() method. It is not required to have a historian connection open to call the LogMessage() method.

Example

HistorianAccessError error;
HistorianAccess historian = new HistorianAccess();

if (!historian.LogMessage(HistorianMessageSeverity.Debug, "debugging text", out error))
    Console.WriteLine("Failed to log message: {0}", error.ErrorDescription);

if (!historian.LogMessage(HistorianMessageSeverity.Info, "info text", out error))
    Console.WriteLine("Failed to log message: {0}", error.ErrorDescription);

if (!historian.LogMessage(HistorianMessageSeverity.Warning, "warning text", out error))
    Console.WriteLine("Failed to log message: {0}", error.ErrorDescription);

if (!historian.LogMessage(HistorianMessageSeverity.Error, "error text", out error))
    Console.WriteLine("Failed to log message: {0}", error.ErrorDescription);

The debug messages are not sent to the Logger unless you enable the Trace log flag for your SDK application in the ArchestrA Logger Log Flag Editor and select Apply. Warning and error messages are be highlighted in the ArchestrA Logger by a yellow and red background, respectively.