Sha256: da370e2fc44e958ef633a42d6b70d651a32ad4b75b26272e2495dd61295ccdf6

Contents?: true

Size: 826 Bytes

Versions: 3

Compression:

Stored size: 826 Bytes

Contents

using System;

using NLog;
using NLog.Targets;
using NLog.Targets.Compound;
using System.Diagnostics;

class Example
{
    static void Main(string[] args)
    {
        FileTarget file1 = new FileTarget();
        file1.FileName = "\\\\server1\\share\\file1.txt";

        FileTarget file2 = new FileTarget();
        file2.FileName = "\\\\server2\\share\\file1.txt";


        // write to server1, if it fails switch to server2
        FallbackTarget target = new FallbackTarget();

        target.ReturnToFirstOnSuccess = false;
        target.Targets.Add(file1);
        target.Targets.Add(file2);

        NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);

        Logger logger = LogManager.GetLogger("Example");
        logger.Debug("log message");
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/FallbackGroup/Simple/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/FallbackGroup/Simple/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/FallbackGroup/Simple/Example.cs