Skip to main content

Introducing Formengine - The New Formbuilder, try for FREE formengine.io.

Version: 6.1.0

Logging in Workflow Server

Setting up logging

Starting with version 2.3, logging is built into Workflow Server. Logging to the following targets is supported:

  • Console.
  • VS debug output.
  • File.
  • Windows event log.
  • Database.

Windows Event Log is only available if Workflow Server is running as a Windows service.

Three types of messages are logged:

  • Info - informational message.
  • Debug - debug message.
  • Error - error message.

Logging 1

The logging subsystem is configured on the Dashboard tab. Here you can choose which types of messages will be logged and which targets will be used. Logging to files has advanced settings.

  • File name & path - the base name for the log file and the path to it. This setting is required. You can specify either a relative or an absolute path.
  • Max file size (bytes) - the maximum file size in bytes. The file size is not restricted if the value is not specified. If the specified size is exceeded, the next log file will be created.
  • Rolling interval - the time interval through which the next log file is created.
  • Max number of files - the maximum number of saved log files.
tip

Please note that if Workflow Server is started as a Service and are used logging to file, then might be better specify the full path to the file and create a folder for storing logs in advance in order to avoid errors due to the lack of service's rights to create folders.

Log access

Workflow Server includes an interface to access log files. This interface can only be used if you use logging to files.

Logging 2

Using this interface, you can find and download all log files for a certain period and see recent entries in the latest log file. A click in the grid with a log, opens a window for viewing a log entry.

Logging through Workflow API

In WorkflowAPI there are 3 methods LogInfo, LogError and LogDebug. You can use them to write to the log using HTTP requests. Parameters of these methods are available in Workflow API.

Logging from Code Actions

Workflow Server initializes the workflowRuntime.Logger with its internal logger. Since the WorkflowRuntime instance is available in any Code Action, you can easily write to the log. The WorkflowRuntime instance is passed to the Code Actions as a parameter with the name runtime. Thus, you can write to the log with the following code:

runtime.Logger.Debug(string messageTemplate, params object[] propertyValues);
runtime.Logger.Debug(string messageTemplate);
runtime.Logger.Debug(Exception exception, string messageTemplate);
runtime.Logger.Debug(Exception exception, string messageTemplate, params object[] propertyValues);
runtime.Logger.Error(Exception exception, string messageTemplate, params object[] propertyValues);
runtime.Logger.Error(string messageTemplate);
runtime.Logger.Error(Exception exception, string messageTemplate);
runtime.Logger.Error(string messageTemplate, params object[] propertyValues);
runtime.Logger.Info(string messageTemplate, params object[] propertyValues);
runtime.Logger.Info(Exception exception, string messageTemplate, params object[] propertyValues);
runtime.Logger.Info(Exception exception, string messageTemplate);
runtime.Logger.Info(string messageTemplate);

Besides, WorkflowRuntime has the following three methods:

runtime.LogInfo(string message, Dictionary<string, string> parameters);
runtime.LogDebug(string message, Dictionary<string, string> parameters);
runtime.LogError(string message, Dictionary<string, string> parameters);