Sha256: be0aaac8d54be5aca42eaffbebfb2b90c2079836718f0432d9498f601e94437d

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

using NLog;
using NLog.Targets;
using NLog.Targets.Wrappers;

class Example
{
    static void Main(string[] args)
    {
        FileTarget target = new FileTarget();
        target.Layout = "${longdate} ${logger} ${message}";
        target.FileName = "${basedir}/logs/logfile.txt";
        target.KeepFileOpen = false;
        target.Encoding = "iso-8859-2";

        AsyncTargetWrapper wrapper = new AsyncTargetWrapper();
        wrapper.WrappedTarget = target;
        wrapper.QueueLimit = 5000;
        wrapper.OverflowAction = AsyncTargetWrapperOverflowAction.Discard;

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

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

        wrapper.Flush();
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nlog-1.0.0.505.20100822 docs/examples/targets/Configuration API/AsyncWrapper/Wrapping File/Example.cs
nlog-1.0.0.505 docs/examples/targets/Configuration API/AsyncWrapper/Wrapping File/Example.cs
nlog-1.0.0.505-mswin32 docs/examples/targets/Configuration API/AsyncWrapper/Wrapping File/Example.cs