Impact Acquire SDK Python
|
This section contains a detailed explanation how the log output for Impact Acquire devices is configured and how it works in general.
It is only necessary to understand all the details in this chapter if the default configuration shall be modified e.g. by a script or if a custom configuration shall be created and added to an installation package of an application. Otherwise using DeviceConfigure can be used to set up logging according to an application's needs. How to do this is explained in the manual dealing with the GUI applications of Impact Acquire (e.g. https://www.balluff.com/en-de/online-manuals-mv)
The key to all *.log-output is a parameter file called mvDebugFlags.mvd
. The file itself is an XML file containing sections for each library and each device the user wants to get *.log output from. The first line in this file should be the XML declaration and therefore will look somehow like this:
To form a well formed and valid XML document a root item must be introduced. For this file it will be a tag call DebugWriterList
. The simplest structure this file can have therefore will be something like this:
Within this root item an arbitrary number of log sections (tag name: DebugWriter ) can be placed. All other XML tags will be ignored.
The D ocument T ype D escription (DTD) for this file therefore can roughly be expressed like this:
One log section in the *.mvd-file looks more or less like this:
A complete parameter file to define and configure *.log output for a certain module therefore could look like this:
The meaning of the individual attributes will be explained in the following sub sections.
The order of appearance of the attributes is not defined and not all attributes are required. The following sample will all be valid *.log-configuration:
The complete DTD for log configuration files looks like this:
The name
attribute is the name of the library (without extension) or the device for which *.log-output shall be generated. In this case, it's the mvDeviceManager library. For devices the name will build from the value of the property 'Family' in the device list, a dash ('-') and the current device ID. So e.g. mvVirtualDevice-666 would specify the log-section for a device belonging to the product family group mvVirtualDevice and has been assigned a device ID of 666. In the parameter file the corresponding section would look somehow like this:
The flags
attribute is a string containing either 0 or 1 for controlling the log output. For most of the flags, 0 means that these *.log-messages will NOT be written to the log output and 1 that the messages will be sent to the log output. For the first digit (the 8th from the right), a 1 means that the time stamp format should be output as a monotonously incremented number of milliseconds after a OS-specific time, like for all versions of Impact Acquire before 2.51, while a 0 means a local time with milliseconds precision.
From right to left the numbers have the following meaning:
So something like this:
will result in messages internally classified as important information (first "1" from the right), warning (second "1" from the right) or error (third "1" from the right) to be sent to the output.
Log messages can be sent to multiple destinations. where the output will be sent to can be defined by the attribute outputmask
. It contains three digits (either "0" or "1") to activate certain destinations. The rightmost digit defines the system's standard output, the digit in the middle the system's standard debug output and the digit on the left a file.
From right to left the flags have the following meaning:
So
results in log messages to be sent to the system's standard debug output AND a file while
would send the log messages to the system's standard output only.
If log messages shall be sent to a file, this attribute should contain the name of the output file.
If the name of the output file starts with STDLOGDIR then the file will be created in the same folder where the file mvDebugFlags.mvd
is located after the installation.
So
on Windows® will send all log messages to "%PUBLIC%/Documents/Balluff/ImpactAcquire/Logs"
(or "%MVIMPACT_ACQUIRE_DATA_DIR%/Logs"
which will point to the same folder), while on Linux the log messages can be found in /opt/ImpactAcquire/data/logs
.
Once a device has been initialized the name and the full path to the log file can be obtained by reading the value of the property
xml
explicitly. If the file name does not end with xml
it will be appended automatically. This however implies, that only the XML format is currently supported and later will be the default.Defines if new information is appended at the end of an existing file from a previous session ('0' ), or if a new file shall be created for each session ('1' ) overwriting existing files.
Defines if upon creation of a new (clean) log file a backup (using the *.bak extension) of the file from a previous session with the same name shall be created ('1' ), or not ('1' ).
Defines the output format for the log file output. It can be
text
for txt-style output.xml
for XML file output with a user definable stylesheet.mvlog
to create log files that can be displayed using mvLogFileViewer.html.If this parameter is not present, XML file output will be used. Only in this mode the stylesheet
parameter will be taken into account.
Defines the timestamp format used by the log messages. Valid values for this attribute are
relative_ms
(in this mode the timestamps represent the number of milliseconds since the system has been started (Windows) or since the Unix epoch (01.01.1970))local_ms
(in this mode the timestamps represent the actual local system time with millisecond precision)Defines if a stylesheet shall be embedded into the log-file. If no stylesheet shall be referenced by the resulting log-file this attribute must be set to none
. Otherwise the value of this attribute defines the name of the stylesheet file that will later be used to transform the log-file into the desired output format.
mvIMPACT_acquireLogFile.xsl
will be embedded in the *.log-file. This stylesheet is part of the installation and will be installed to the same directory as the *.mvd-file.mvDebugFlags.mvd
on Windows® will be installed to
"%PUBLIC%/Documents/Balluff/ImpactAcquire/Logs"
or "%MVIMPACT_ACQUIRE_DATA_DIR%/Logs"
which will point to the same folderwhenever a device driver is installed. On Windows® this is the one and only location, where this file can be located. Otherwise, no log-files will be created.
Whenever a Linux driver package is installed, the mvDebugFlags.mvd
file will be installed in the folder $MVIMPACT_ACQUIRE_DATA_DIR/logs
which is by default /opt/ImpactAcquire/data/logs
.
All installation packages shipped on Windows® platforms internally make use of the MSI (Microsoft Windows® Installer™) technology. Most of the packages therefore will be *.msi files while some packages are distributed as so called bootstrappers which will be *.exe files. In case you ever run into trouble during the installation of a packages before contacting the support team please create a log-file of the installation process. This can be achieved like this: