Files
EBoard/电子展板/Configs/NLog.config
2025-09-19 17:42:11 +08:00

95 lines
3.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<!--此部分中的所有目标将自动异步-->
<target name="asyncFile" xsi:type="AsyncWrapper">
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
<target name="log_file" xsi:type="File"
fileName="${basedir}/Log/${shortdate}.log"
layout="${longdate} [${threadid}] ${level} - ${message} ${onexception:${exception:format=message} ${newline} ${stacktrace} ${newline}"
archiveFileName="${basedir}/Log/${shortdate}-{#####}.log"
archiveAboveSize="102400"
archiveNumbering="Sequence"
maxArchiveDays="30"
concurrentWrites="true"
keepFileOpen="false" />
<!-- 2025-07-28 10:55:15.9719 [1] Info - Message -->
</target>
<!--使用可自定义的着色将日志消息写入控制台-->
<target name="colorConsole" xsi:type="ColoredConsole" layout="[${date:format=HH\:mm\:ss}]:${message} ${exception:format=message}" />
</targets>
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
<rules>
<logger name="Microsoft.*" minlevel="Info" writeTo="" final="true" />
<logger name="*" minlevel="Info" writeTo="asyncFile" />
<logger name="*" minlevel="Info" writeTo="colorConsole" />
</rules>
<!--
NLog允许的日志级别由高到低依次是
Fatal
Error
Warn
Info
Debug
Trace
Off
-->
<!--
${all-event-properties} 事件日志上下文
${appdomain} 当前应用程序域
${assembly-version} 应用程序
${basedir} 应用程序域的基本目录。
${callsite} (类名称、方法名称和相关信息的源信息)。
${callsite-linenumber} 调用类的
${counter} 数值
${date} 当前日期和时间。
${document-uri} 用于Silverlight应用。
${environment} 环境变量
${event-properties}
${exception} exception信息
${file-contents} 显示指定文件的内容
${gc} 垃圾收集器
${gdc} 诊断上下文
${guid} GUID
${identity} 线程标识信息
${install-context} 安装参数
${level} 级别。
${literal}
${log4jxmlevent} XML事件描述
${logger} 记录器的名字
${longdate} 日期和时间的格式分类yyyy-MM-dd HH:mm:ss.ffff。
${machinename} 名称
${mdc} 映射诊断
${mdlc} 异步映射诊断上下文
${message} 消息
${ndc} 线程结构
${ndlc} 异步线程
${newline} 文字换行
${nlogdir} nlog.dll目录。
${performancecounter} 述性能计数器。
${processid} 当前进程标识符
${processinfo} 运行信息
${processname} 当前进程的名称。
${processtime} 该时间过程中格式HH:MM:ss.mmm。
${qpc} 高精度定时器基于返回的值从queryperformancecounter(任选地)转换为秒。
${registry} 从注册表中的值。
${sequenceid} ID
${shortdate} 短时间 格式YYYY-MM-DD。
${sl-appinfo} Silverlight应用。
${specialfolder} 文件夹路径
${stacktrace} 堆栈跟踪渲染器。
${tempdir} 临时目录中。
${threadid} 当前线程的标识符。
${threadname} 当前线程。
${ticks} 当前日期和时间。
${time} 24小时格式HH:MM:ss.mmm。
${var} {$var}-提供新的变量(4.1)
${windows-identity} windows线程标识信息(用户名)
-->
</nlog>