Sha256: 0af7ad088ec04c451de6f9bfc37c13e79d586eb46dfae883699d8c410dd4dff7

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 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";
        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 queue.");
        l.Debug("This is a debug information. It goes to .\\private$\\nlog queue.");
        l.Info("This is a information. It goes to .\\private$\\nlog queue.");
        l.Warn("This is a warn information. It goes to .\\private$\\nlog queue.");
        l.Fatal("This is a fatal information. It goes to .\\private$\\nlog queue.");
        l.Trace("This is a trace information. It goes to .\\private$\\nlog 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/Simple/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/MSMQ/Simple/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/MSMQ/Simple/Example.cs