Starting with version 2.3, logging is built into Workflow Server. Logging to the following targets is supported:
Windows Event Log is only available if Workflow Server is running as a Windows service.
Three types of messages are logged:
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.
Please note that if you start Workflow Server as a Service and use logging to files, then you better specify the full path to the file and create a folder for logs in advance in order to avoid errors due to the lack of service's rights to create folders.
Workflow Server includes an interface to access log files. This interface can only be used if you use logging to files.
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 double click on a line in a grid with a log opens a window for viewing a log entry.
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 described here.
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 nameruntime
. 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);