Sha256: 893bf79b66719105a27e40bc50a22ec664745fc28f1581ec30b4f96b649f8302

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

using NLog;
using NLog.Config;
using NLog.Win32.Targets;

class Example
{
    static void Main(string[] args)
    {
        NLog.Internal.InternalLogger.LogToConsole = true;

        MSMQTarget target = new MSMQTarget();
        target.Queue = ".\\private$\\nlog.${level}";
        target.Label = "${message}";
        target.Layout = "${message}";
        target.CreateQueueIfNotExists = true;
        target.Recoverable = true;

        SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Trace);

        Logger l = LogManager.GetLogger("AAA");
        l.Error("This is an error. It goes to .\\private$\\nlog.Error queue.");
        l.Debug("This is a debug information. It goes to .\\private$\\nlog.Debug queue.");
        l.Info("This is a information. It goes to .\\private$\\nlog.Info queue.");
        l.Warn("This is a warn information. It goes to .\\private$\\nlog.Warn queue.");
        l.Fatal("This is a fatal information. It goes to .\\private$\\nlog.Fatal queue.");
        l.Trace("This is a trace information. It goes to .\\private$\\nlog.Trace queue.");
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/MSMQ/Multiple Queues/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/MSMQ/Multiple Queues/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/MSMQ/Multiple Queues/Example.cs