OpcCmd Utility Tips and Tricks: Difference between revisions

From OPC Labs Knowledge Base
(Created page with "Category:OpcCmd Utility Category:Tips and tricks ; Displaying exception information from an event : If a command produces events that contain errors, you may want to d...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
; Displaying exception information from an event
; Displaying exception information from an event
: If a command produces events that contain errors, you may want to display the details of the exception information related to particular event in a nicely formatted way, analogically to what the <code>error?</code> (shortened: <code>er?</code>) command does. To do so, determine the index ''eventIndex'' of the event in the sequence, and then enter the following command: <code>events? ''eventIndex'' --!extractMember EventArgs.ErrorDescendInfos</code> (shortened: <code>ev? ''eventIndex'' -!xm EventArgs.ErrorDescendInfos</code>). The resulting table starts with a row for the outmost exception, and the subsequent row(s) contain the inner exception(s), recursively. An error ID and the full error message is listed with each exception.
: If a command produces events that contain errors, you may want to display the details of the exception information related to particular event in a nicely formatted way, analogically to what the <code>error?</code> (shortened: <code>er?</code>) command does. To do so, determine the index ''eventIndex'' of the event in the sequence, and then enter the following command: <code>events? ''eventIndex'' --!extractMember EventArgs.ErrorDescendInfos</code> (shortened: <code>ev? ''eventIndex'' -!xm EventArgs.ErrorDescendInfos</code>). The resulting table starts with a row for the outmost exception, and the subsequent row(s) contain the inner exception(s), recursively. An error ID and the full error message is listed with each exception.
; How can I enable the log (trace) entries from OPC UA stack and SDK with commands like uaClient or uaServer?
: <code>!diagnostics sources setSwitchValue Verbose OpcLabs.EasyOpc.UA.UAEngineBase.SdkLog</code>
; How can I direct all tracing output from OpcCmd to a file?
: In the application configuration file for OpcCmd ('''OpcCmd.exe.config''' or '''OpcCmd.dll.config'''), uncomment an entry that corresponds to a type of trace listener you want to use, under (XPath)  '''/configuration/system.diagnostics/source/source[@name='$ImplicitListeners']/listeners''' . For example, uncomment <code><add name="DelimitedList"/></code> in order to obtain direct all tracing output to a CSV file named (by default) '''TraceOutput-DelimitedList.csv''', using the [https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.delimitedlisttracelistener DelimitedListTraceListener Class].

Latest revision as of 14:51, 13 December 2024

Displaying exception information from an event
If a command produces events that contain errors, you may want to display the details of the exception information related to particular event in a nicely formatted way, analogically to what the error? (shortened: er?) command does. To do so, determine the index eventIndex of the event in the sequence, and then enter the following command: events? eventIndex --!extractMember EventArgs.ErrorDescendInfos (shortened: ev? eventIndex -!xm EventArgs.ErrorDescendInfos). The resulting table starts with a row for the outmost exception, and the subsequent row(s) contain the inner exception(s), recursively. An error ID and the full error message is listed with each exception.
How can I enable the log (trace) entries from OPC UA stack and SDK with commands like uaClient or uaServer?
!diagnostics sources setSwitchValue Verbose OpcLabs.EasyOpc.UA.UAEngineBase.SdkLog
How can I direct all tracing output from OpcCmd to a file?
In the application configuration file for OpcCmd (OpcCmd.exe.config or OpcCmd.dll.config), uncomment an entry that corresponds to a type of trace listener you want to use, under (XPath) /configuration/system.diagnostics/source/source[@name='$ImplicitListeners']/listeners . For example, uncomment <add name="DelimitedList"/> in order to obtain direct all tracing output to a CSV file named (by default) TraceOutput-DelimitedList.csv, using the DelimitedListTraceListener Class.