Host Server logging

To troubleshoot issues in the hosted services inside the product service, you can run the product application service in console mode and/or enable logging output with various output targets and levels of verbosity. Several standard logging providers are available in the product, and you can create customized extensions to fit your needs. You can also choose which extensions are active and the message severity level (LogLevel) that is logged. To change the server logging configuration, edit the logging extension properties in the HostServerLogging.config file in the [Program Files]\K2\Host Server\Bin folder.

There are really only two sections of the HostServerLogging.config file you will need to modify to configure. logging. For most situations, you need only set the specific log destination’s Active flag to true or false, and specify the severity of messages to log. In rare circumstances, you may need to modify the appSettings section of the file, particularly to disable asynchronous queuing and to include a stack trace.

By default, console logging is turned on, but at the “Info” severity level. Thus, if you start the product server in console mode without modifying the HostServerLogging.config file, you will see Informational, Warning, and Error messages. File-based logging is turned off by default.

The two most common forms of logging are “to Console” and “to File”. Logging to the console is very useful for troubleshooting and validating general issues. However, from a performance perspective, logging to the console has high overhead, and should only be enabled when needed. Similarly, logging to file has some additional overhead. It is therefore recommended to only log “All” events to file during periods of troubleshooting. For more regular monitoring purposes, you should scale back file-based logging to only log events of severity Warning or higher.
If you edit the logging configuration, you must restart the server for the changes to take effect.

Host Server logging is typically useful for troubleshooting

  • Service startup failures
  • Authentication failures
  • Communication issues
  • Verifying that Actions are being sent to the K2 Server (and the correct K2 Server)
  • Verifying that Workflows are being processed

The system writes the Host Server logs to the [Program Files]\K2\Host Server\Bin folder by default. The default file name is HostServer.log with the timestamp and cycle number appended to the name.

  • Timestamp: this is the date the file was created and is in the format YYMMDD. For example: 190618 is June 18th, 2019.
  • Log cycle: this is a sequential number for logs created on the same day. The system creates a new log file when the current log file reaches a configured size, or when it has been in use for a certain amount of time. The File logging extension section below describes these settings. For example, the second log created on the 18th of June 2019 would have the file name: HostServer190618_2.log

The default location of the file is: "%ProgramFiles%\K2\Host Server\Bin\HostServerLogging.config". It is a standard XML file and you can use a text editor to edit it.

There are 5 sections to the configuration file that apply to logging:

This topic describes logging defaults. These defaults are the recommended level of logging. You should adjust default logging if you understand the impact of doing so, and typically only for the duration of the troubleshooting task. Contact Nintex K2 Product Support services if you need assistance with configuring logging or interpreting log output.
Backup the config file so that you can restore the defaults when you finish troubleshooting.

Logging and Performance

As previously mentioned, each type of Host Server logging has its own performance implications. With stack trace disabled, and asynchronous queuing in use, only the log destination-type determines performance impacts. Informal tests have shown the performance quality to be (from best to worst):

  1. All Logging disabled
  2. Console (ConsoleExtension)
  3. SQL (ArchiveExtension)
  4. Event Logs (EventLogExtension)
  5. File (FileExtension)

Console logging offers no means of storing the logs past the buffer of the console window. Event Logs and SQL have similar performance; the distinguishing characteristic between them is ease of consumption. Event Logs tend to be difficult to traverse and can bog down heavily based on other OS-level conditions, whereas SQL is a much more flexible means of storage – offering much greater storage and filtering capacity. File logging is convenient for portability during troubleshooting, but has the highest overhead.

Considerations

  • The HostServerLogging.config file is case-sensitive. Active="True" is not the same as Active="true". The correct case is necessary or the K2 Host Server will not start.
  • Enable logging at the severity level necessary, and to the most efficient destination possible. Bear in mind that your performance impacts and needs should play a significant part in your logging decisions.
  • During setup, testing, and troubleshooting, increases the level of logging to Debug. This will allow you to see the maximum amount of information, and more easily determine exactly what is/isn’t working. Console and/or File logging are typically best suited to short-term monitoring that fits these use models.
  • During normal operations, scale back the severity of messages being logged, especially to the slower destinations. If needed, reserve File logging for only the most severe messages (Error). Use SQL logging for storing larger volumes of information, and/or for consolidating data from multiple farm nodes.
  • Normal operating conditions should generally not need more than Warning level messages.
  • Only use Synchronous logging and stack trace inclusion under the supervision of Nintex K2 Support staff. You should not use these options under normal operating conditions.