The Systemite.SystemWeaver.TcpSubServer.exe does not need an .ini file since it gets its settings from the swDBServer executable. It does, however, need its own properties file (.props) for logging. There are two log files that can be activated - the default TcpSubServer log and the Statistic log. 


Prerequisites

  • A Server installation directory containing all required files to run the server.
  • A Systemite.SystemWeaver.TcpSubServer.exe.nlog located in the same directory as the server files.
  • Sufficient disk space must be available for storing the files.


Note: If running a mirror server, and you would like logging for that server as well, you will need to configure it for the mirror server locally on that server machine.


Tip: The TcpSubServer logging is built on NLog. There are many NLog config options. Below is an example of dividing the TcpSubServer log file(s) into smaller volumes, i.e., a new log file each day, using shortdate.

Instead of:
fileName="D:/statistics/filename.log"

Use: 

fileName="D:/statistics/Statistics_${shortdate}.log"


(https://nlog-project.org/config/)


Systemite can provide an example file or simply copy the following content into a text editor.


Systemite.SystemWeaver.TcpSubServer.exe.nlog

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      throwExceptions="false">

  <variable name="appName" value="YourAppName" />

  <targets async="true">
    <target xsi:type="File"
            name="default"
            layout="${longdate} [${threadid}] - ${level:uppercase=true}  ${message}${onexception:${newline}EXCEPTION\: ${exception:format=ToString}}"
            fileName="D:\TcpSubServer.log"
            keepFileOpen="false"
            />

    <target xsi:type="EventLog"
            name="eventlog"
            source="${appName}"
            layout="${message}${newline}${exception:format=ToString}"/>

    <!--target name="statisticsLogFileAsync"
            xsi:type="AsyncWrapper"
            overflowAction="Grow"
            queueLimit="10000"
            batchSize="100"
            timeToSleepBetweenBatches="50">
      <target xsi:type="File"
              name="statisticsLogFile"
              fileName="C:\temp\Statistics.log">
        <layout xsi:type="JsonLayout">
          <attribute name="time" layout="${longdate}" />
          <attribute name='seqId' layout='${event-properties:seqId}' />
          <attribute name='sessionId' layout='${event-properties:sessionId}' />
          <attribute name='ip' layout='${event-properties:ip}' />
          <attribute name='userId' layout='${event-properties:userId}' />
          <attribute name='userName' layout='${event-properties:userName}' />
          <attribute name='email' layout='${event-properties:email}' />
          <attribute name='appName' layout='${event-properties:appName}' />
          <attribute name='event' encode='false'>
            <layout type='JsonLayout' renderEmptyObject="false">
              <attribute name='type' layout='${event-properties:eventType}' />
            </layout>
          </attribute>
          <attribute name='call' encode='false'>
            <layout type='JsonLayout' renderEmptyObject="false">
              <attribute name='type' layout='${event-properties:callType}' />
            </layout>
          </attribute>
          <attribute name='action' encode='false'>
            <layout type='JsonLayout' renderEmptyObject="false">
              <attribute name='type' layout='${event-properties:actionType}' />
            </layout>
          </attribute>
        </layout>
      </target>
    </target-->
  </targets>
  
  <rules>
    <logger name="*" writeTo="default" minlevel="Info" />
    <logger name="*" writeTo="eventlog" minlevel="Error" />
    <!--logger name="StatisticsLogger" minlevel="Info" writeTo="statisticsLogFileAsync" /-->
  </rules>
</nlog>

Configuring the TcpSubServer Log

This log file contains client/application information for connects, disconnects, etc. We strongly recommend that this logging is turned on.

  1. Save the file as Systemite.SystemWeaver.TcpSubServer.exe.nlog.
  2. Open the file and update the fileName= line to indicate the TCPSubServer.log file name and the correct path to where you want the log to be placed. Naming it TCPSubServer.log will differentiate it from the swServer.log and ensure two separate log files should you have them generating in the same location.
  3. Save your changes.


Configuring the Statistics Log

The configuration file offers an optional, separate logging of certain user operations and usage statistics. 


To enable, uncomment the target name for "statisticsLogFileAsync". Update the fileName= line in the target to indicate the desired file name and the correct path to where you want the log to be placed. The default filename is Statistics.Log, but you can change it to another that is unique in your target directory. 



Also, uncomment the rule for "statisticsLogFileAsync" at the bottom of the file. 



The log is JSON formatted and can easily be read, analyzed and visualized using an external tool.


Note: We recommend that you do not make any changes to the settings in the top section of the target. 



Starting the Logging

Default Log

The Default logging will start automatically once you start and/or restart the main server. 


Statistics Log

The Statistic log will generate upon the first login to the server. 


For a brief explanation of the content of the log files, see Overview of Server Log Files.


Note: If the main server is running while you complete the configuration, it must be stopped and then restarted for the logging to begin successfully.


Maintaining TcpSubServer Log Files

If the decision is made to generate these log files, we recommend having a standard procedure in place to manage them, e.g., archive, delete, or move old files, monitor disk space, etc. The TcpSubServer files can become quite large especially if the server is not restarted in a very long time. If the size becomes an issue, you can move or delete a TcpSubServer file. However, if the file you wish to move or delete is the one currently being written to by the server, you must first stop the server before moving or deleting it. When you restart the server, a new file will generate. If there are multiple TcpSubServer files saved, you can always delete older versions at any time.  


Sending a Copy to Systemite Support

This file can be useful for troubleshooting purposes. If Systemite requests this file for troubleshooting purposes, make a copy of the file that includes the time period in question, compress it, and upload the copy to SystemiteNAS. For a brief explanation of the file's content, see Explanation of Server Log Files.