WEBfactory 2010

Using BACnet Logging

The current article contains descriptive information on:

Setting up BACnet Windows Service logging

Logging the BACnet Windows Service activity can greatly improve the speed and accuracy of debugging and troubleshooting BACnet Windows Service issues in WEBfactory 2010.

The logging for BACnet Windows Service can be easily set up by following the guide below:

  1. Locate and open the WFBacNetService.exe.config file in any text editor desired. If using a default WEBfactory 2010 installation, the WFBacNetService.exe.config file will be located in C:\Program Files (x86)\WEBfactory 2010\Server\BacNet\Service or C:\Program Files\WEBfactory 2010\Server\BacNet\Service on a x86 machine.

  2. Inside the WFBacNetService.exe.config file, locate an uncomment (remove the <!-- from the beginning of the line and the --> from the end of the line) the target line, line 84:

    <!--<target xsi:type="File" name="file" fileName="C:\Logs\bacnet.log" layout="${longdate}|${level:uppercase=true}|${logger}|${message}${onexception:EXCEPTION OCCURRED\:${exception:format=tostring}}"/>-->

  3. Locate and uncomment (using the same procedure as above) the rule line, line 89:

    <!--<logger name="*" minlevel="Trace" writeTo="file" />-->

  4. Restart the BACnet Windows Service form the WEBfactoryService Manager.

    Capture2228.jpg

It is recommended to turn off the logging after the troubleshooting session has ended, in order to avoid filling the hard disk space with unnecessary logs.

BACnet Windows Service logging configuration

Taking a closer look at the line specifying the target inside the WFBacNetService.exe.config file will reveal the configuration options for BACnet Windows Service logging:

  • The fileName attribute sets the path and the name of the log file. The user can alter it's value and specify any existing folder and file name.

The rule line provides the option to configure the logging level:

  • The minlevel attribute sets the minimum level for logging. The user can set it to Trance, Warn or Error.

Setting up BACnet Connector configuration logging

The logging for BACnet Connector must be manually enabled using the Registry Editor tool available in any Windows OS. The BACnet Connector registry settings location depends on the operating system:

  • If WEBfactory 2010 is installed on a x64 machine, the BACnet Connector registry settings are available at

    HKEY_LOCAL _MACHINE\SOFTWARE\Wow6432Node\WEBfactory\BACnet\1.0.

  • If WEBfactory 2010 is installed on a x86 machine, the BACnet Connector registry settings are available at

    HKEY_LOCAL _MACHINE\SOFTWARE\WEBfactory\BACnet\1.0.

By default, the following registry values are available for the BACnet Connector key:

Value

Type

Details

MessageLevelMask

DWORD

A 32 bit mask specifying logging that is produced by BACnet Connector and that is subsequently being submitted into the WTS.

MessageLevelMask bits for BACnet Connector:

  • Bit 0 specifies tracing of errors

  • Bit 1 specifies tracing of warnings

  • Bit 2 specifies tracing of infos

  • Bit 3 is group specification bit for debugging messages

  • Bits 16, 17, 18, 19, 20, 21, 22, 23 specify dedicated types of debugging messages

Finding the best log file detail balance means a compromise between:

  • Finding all possible information in the log files

  • Achieving a humanly readable volume of logged information

  • Not influencing software operation by delays caused by excessive logging

  • Limited hard disk space

Full logging rate can be in the range of tens of thousands lines per second and can cause problems with Cimetrics toolkit. Therefore implicit mask should have bits 0, 1 and 2 set.

ToolBoxInstalled

DWORD

Either 0 or 1. Specifies if the BACnet ToolBox is installed on the system.

VB6DataTypes

DWORD

Either 0 or 1. Controls data type transformation for VB6.

To enable the logging for BACnet Connector, the user must manually add the following value:

Value

Type

Details

ConfigXMLSavePath

STRING

Specifies the path where the XML configuration received in Init method would be stored. This XML configuration is stored prior to checking of its correctness. Tabs and newlines are inserted into stored configuration just as well.

Capture2226.jpg

The BACnet Connector registry settings with configuration logging enabled

Setting up WEBfactory Trace Service (WTS) logging
Setting up WTS logging for single log file group

Using the following method, the user can enable logging for multiple Channels (tools and services provided by WEBfactory 2010) that will be saved on disk in the same log file.

To log each channel events in separate files, follow the guide in the sub-section below.

To enable WEBfactory Trace Service logging, the user can use the WEBfactory Activity Analyzer tool and activate the File Writer in order to store the logs on the hard drive:

  1. Open the WEBfactory ActivityAnalyzer and click the Options button.

    Capture2229.jpg
  2. In the Options window, click on the File writer tab. Check the Enable file writer checkbox to write the logs to the disk.

    Capture2230.jpg
  3. Set the Trance logs path to an existing folder on the hard disk.

  4. Set the Max. trace log files (the maximum amount of log files to be stored) value.

  5. Set the Max. trace log entries (the maximum size on disk - by default in MB - of all the stored log files) value.

  6. Set the Standard filter (the logging filter) for the desired channel.

    Capture2231.jpg
  7. Optional, the user can set and Advanced filter and define the Channel, Message topic and Message level manually.

    Capture2232.jpg

For more control over the logging options, the same settings can be accessed in the Registry Editor. The key location depends on the operating system:

  • On x64 version of operating system, WTS registry settings are located at:

    HKEY_LOCAL _MACHINE\SOFTWARE\Wow6432Node\WEBfactory\WTS\1.0\LoggerKeys\FileWriter

  • On x86 machines, the Wow6432Node is missing, so the WTS registry settings would be located at:

    HKEY_LOCAL _MACHINE\SOFTWARE\WEBfactory\WTS\1.0\LoggerKeys\FileWriter

Capture2233.jpg

The FileWriter key hosts the following values:

Value

Type

Details

Active

DWORD

Either 0 or 1, specifying if log group is active or not. Only active log groups are being logged.

LogFilter

STRING

Specifies filtering for messages. For BACnet logging filter would be BACnet*&amp;amp;*&amp;amp;FFFFFFFF.

LogMaxCompleteSize

DWORD

Specifies the maximum number of bytes in all log files that exist in any moment. If log file currently being written exceeds in size LogMaxCompleteSize or LogMaxFileCount bytes, than log file is closed and new log file with new, higher number is started.

LogMaxCompleteSizeUnit

DWORD

Specifies unit size for LogMaxCompeteSize value. In example above, LogMaxCompleteSizeUnit is 1 MByte, and as LogMaxCompleteSize is 100 dec., size of all undeleted log files is 100 MBytes. The size of a single individual log file is 20 times smaller because LogMaxFileCount is 20, that is 5 MBytes. If LogMaxCompleteSizeUnit is missing, than LogMaxCompleteSize is in bytes.

LogMaxFileCount

DWORD

Specifies the maximum number of files in a file group. When the maximum number of files in a file group is exceeded, the oldest file (the file with smallest number) is deleted. The content of the log files is never overwritten. New files are being added and oldest files are being deleted, so the count of the files that exist in any moment does not exceed LogMaxFileCount.

LogPathName

STRING

Specifies a textual prefix of path name for each file inside the file group. The file path name is generated by adding a prefix, file number, dot and log file extension ([Prefix][FileNumber].log). For example: LogOne_000000001.log, LogOne_000000002.log, LogOne_000000003.log, LogOne_000000004.log, LogOne_000000005.log, etc.

Any number of sub-keys (like FileWriter) can exist for LoggerKeys (at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\WEBfactory\WTS\1.0\LoggerKeys or HKEY_LOCAL_MACHINE\SOFTWARE\WEBfactory\WTS\1.0\LoggerKeys).

This way, multiple file groups can be set up for logging.

Setting up WTS logging for additional log file groups

By default, WEBfactory Trace Service logs all the selected channels in the same log file groups. Setting up WTS logging from the Registry Editor allows the user to configure multiple log file groups to be written, each for a separate channel. This can be helpful in order to avoid searching through all the logged information for a specific channel.

To create a separate log file group for logging, for example, the BACnet channel, the user has to manually create a sub-key under the FileWriter key and create the needed values.

An example of a secondary file group for logging would be:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\WEBfactory\WTS\1.0\LoggerKeys\ExampleFileGroup]
"LogPathName"="C:\\SecondFileGroup\\"
"LogMaxCompleteSize"=dword:00000064
"Active"=dword:00000001
"LogMaxFileCount"=dword:00000014
"LogFilter"="BACnet*&*&1"
"LogMaxCompleteSizeUnit"=dword:000f4240
Capture2234.jpg

The key and values can be manually created inside the Registry Editor or can be added using a .reg script.

Registry script example: SecondFileGroup.reg (zip archive)

The script above can be edited and used to add the desired secondary file group for logging a channel.

The LogPathName directory structure must exist on the disk before using it.

WTS must be restarted for the registry settings changes to take effect!