NLog CSV Rolling
来源:互联网 发布:淘宝客推广需要审核吗 编辑:程序博客网 时间:2024/06/08 08:23
using NLog;
using NLog.Targets;
using NLog.Layouts;
FileTarget target = new FileTarget();
target.FileName = "${basedir}/log.csv";
// where to store the archive files
target.ArchiveFileName = "${basedir}/log_archives/log.{#####}.csv";
target.ArchiveEvery = FileTarget.ArchiveEveryMode.None;
target.ArchiveNumbering = FileTarget.ArchiveNumberingMode.Rolling;
target.MaxArchiveFiles = 5;
target.ArchiveAboveSize = 1024 * 1024; //1 M
CsvLayout layout = new CsvLayout();
layout.Columns.Add(new CsvColumn("time", "${longdate}"));
layout.Columns.Add(new CsvColumn("message", "${message}"));
layout.Columns.Add(new CsvColumn("logger", "${logger}"));
layout.Columns.Add(new CsvColumn("level", "${level}"));
target.CompiledLayout = layout;
// this speeds up things when no other processes are writing to the file
target.ConcurrentWrites = true;
NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
Logger logger = LogManager.GetLogger(this.GetType().Namespace);
logger.Debug("Test");
using NLog.Targets;
using NLog.Layouts;
FileTarget target = new FileTarget();
target.FileName = "${basedir}/log.csv";
// where to store the archive files
target.ArchiveFileName = "${basedir}/log_archives/log.{#####}.csv";
target.ArchiveEvery = FileTarget.ArchiveEveryMode.None;
target.ArchiveNumbering = FileTarget.ArchiveNumberingMode.Rolling;
target.MaxArchiveFiles = 5;
target.ArchiveAboveSize = 1024 * 1024; //1 M
CsvLayout layout = new CsvLayout();
layout.Columns.Add(new CsvColumn("time", "${longdate}"));
layout.Columns.Add(new CsvColumn("message", "${message}"));
layout.Columns.Add(new CsvColumn("logger", "${logger}"));
layout.Columns.Add(new CsvColumn("level", "${level}"));
target.CompiledLayout = layout;
// this speeds up things when no other processes are writing to the file
target.ConcurrentWrites = true;
NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
Logger logger = LogManager.GetLogger(this.GetType().Namespace);
logger.Debug("Test");
- NLog CSV Rolling
- Nlog
- Nlog
- NLog
- Nlog(zz)
- NLog初步
- NLog使用
- NLog 相关
- 日志Nlog
- NLog日志
- rolling hash
- Rolling Variance
- Rolling Patch
- CSV
- CSV
- csv
- csv
- csv
- Visual Unit:单元测试原来可以如此简单
- Excel set dateformat
- 窥探jQuery——面向JavaScript程序员
- 08第一篇
- 什么才是软件开发的葵花宝典?
- NLog CSV Rolling
- ZF开发的PHP应用与传统PHP应用集成的方法
- Inline CTE number table
- detect if a URL is reachable
- 禁止使用xp_cmdShell
- [ORACLE EBS]1. Get the EBS version
- 我悲哀:我只是个互联网的旁观者
- 从程序员到测试工程师
- Drupal 6.0 正式版发布