.NET Based OPC UA Client/Server SDK  3.3.0.530
Using the Trace Functionality

Overview

The SDK comes with a built-in tracing mechanism.

See Trace for more information about to implement the SDK trace into your own applications.

Example

The following examples show how to enable the build-in server trace implementation for the different configuration types. These and other examples can be found in our example application source code.

Look at Trace Settings and Trace Levels in the section Configuration Schema for more configuration options.

XML File Configuration

<Extension>
<TraceSettings xmlns="http://unifiedautomation.com/schemas/2011/12/Application.xsd" MasterTraceEnabled="true" DefaultTraceLevel="Info">
<TraceFile>%CommonApplicationData%\unifiedautomation\logs\UaSdkNet\UaServerNet.log.txt</TraceFile>
<MaxEntriesPerLog>100000</MaxEntriesPerLog>
<MaxLogFileBackups>3</MaxLogFileBackups>
<ModuleSettings>
<ModuleTraceSettings ModuleName="UnifiedAutomation.Stack" TraceEnabled="true"/>
<ModuleTraceSettings ModuleName="UnifiedAutomation.Server" TraceEnabled="true"/>
</ModuleSettings>
<OnlineConfiguration Enabled="true" MaxEntriesPerLogMinimum="1000" MaxEntriesPerLogMaximum="500000" MaxLogFileBackupsMaximum="5"/>
</TraceSettings>
</Extension>

Configuration InMemory

TraceSettings trace = new TraceSettings();
trace.MasterTraceEnabled = true;
trace.DefaultTraceLevel = UnifiedAutomation.UaSchema.TraceLevel.Info;
trace.TraceFile = PlatformUtils.CombinePath(environmentPath, "unifiedautomation", "logs", "UaSdkNet", "UaServerNet.log.txt");
trace.MaxLogFileBackups = 3;
trace.ModuleSettings = new ModuleTraceSettings[]
{
new ModuleTraceSettings() { ModuleName = "UnifiedAutomation.Stack", TraceEnabled = true },
new ModuleTraceSettings() { ModuleName = "UnifiedAutomation.Server", TraceEnabled = true },
};