Workflow and ServiceDesk Community

 View Only

Workflow - Component - Developer Guide - Logging 

Nov 09, 2016 05:19 PM

In this Article I'm going to explain how to Log information in your component.

 

There are times when you wish to log information to the Workflow Logs, for the Project the component is in.

[Install Drive]:\Program Files\Workflow\Logs\*.log

There are a number of log levels you can choose from.

Take the Create Log Entry as an example of which.

  • Info
  • Error
  • Debug
  • Fatal
  • Warn

We have a number of logging methods since we inherit from "AbstractSinglePathProcessComponent" => "AbstractSinglePathComponent" => "AbstractOrchestrationComponent"

namespace LogicBase.Core
{
    public abstract class AbstractOrchestrationComponent : IStorable, IOrchestrationComponent, IValidWithNofication, IValid
    {
        ...
        protected void LogDebug(IData data, string Debug);
        protected void LogError(IData data, Exception ex);
        protected void LogError(IData data, string message);
        protected void LogError(IData data, Exception ex, string message);
        protected void LogFatal(IData data, string message);
        protected void LogFatal(IData data, string message, Exception ex);
        protected void LogInfo(IData data, string Info);
        protected void LogWarn(IData data, string message);
        ...
    }
}

If we start typing Log into VS we will get autocompletion for the following methods.

WorkflowLogLevels.png

We could either call

base.LogError(data, "No rows found.");

Or base. isn't necessary.

LogError(data, "No rows found.");

Another thing I tend to do is add a Checkbox to the component and use that as a way to decide whether to log the information information. You could pass in a Debug flag.

Another option it to always log to Info then turn on the logging level in Workflow Explorer.

Protirus.png

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.