You want to send an email to a System Administrator when an error occurs.


Configure the AGI.Parallel.Host.exe.config or AGI.Parallel.Host_x86.exe.config file to set up the required log4net xml section. For the cluster scheduler, the default location is C:\Program Files (x86)\AGI\STK Scalability 1.2\Agent\bin\AGI.Parallel.Host.exe.config. The file will need write permissions. Add the appender XML element as described in the example code. Once that is done, an email will be sent every time a task logs an error message.


This same pattern can be used to send emails when an error occurs on the agent and the coordinator.

C#  Copy imageCopy
using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;
using AGI.Parallel.Infrastructure.Logging;

namespace CodeSamples
    class Program
        static void Main(string[] args)
             * First, edit your AGI.Parallel.Host.exe.config to add a SMTP appender.
             * This is an example of the log4net xml element.
             * Other examples can be found at
    <priority value="Debug"/>
    <appender-ref ref="SmtpAppender"/>
  <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
    <to value="" />
    <from value="" />
    <subject value="test logging message" />
    <smtpHost value="" />
    <bufferSize value="512" />
    <lossy value="true" />
    <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="ERROR"/>
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />

            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
                Job job = scheduler.CreateJob();
                job.AddTask(new TaskThatWritesToLoggingError());

        public class TaskThatWritesToLoggingError : Task
            public override void Execute()
                ILog log = this.GetProperty<ILog>(TaskProperties.Logger);
                log.Error("This could be sent to your email");


Logging and email can be important for being notified when a task fails or a certain event happens in the system. Internally, log4net is used for logging. Thus, all of the features and properties that log4net provides are available for use.

Use log4net's SmptpAppender to email a user when a task fails. For more examples of different log4net logging examples, see this page: