首页 > 代码库 > Nlog配置实例
Nlog配置实例
彩色Console target
<?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="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false" layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" > <highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" /> <highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" /> <highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" /> <highlight-row condition="level == LogLevel.Error" foregroundColor="Red" /> <highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" backgroundColor="White" /> </target> <target name="infoFile" xsi:type="File" layout="${longdate} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}" fileName="${basedir}/logs/info.log" keepFileOpen="false" encoding="iso-8859-2" /> <target name="errorFile" xsi:type="File" layout="${longdate} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}" fileName="${basedir}/logs/error.log" keepFileOpen="false" encoding="iso-8859-2" /> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="coloredConsole" /> <logger name="*" minlevel="Debug" maxlevel="Info" writeTo="infoFile" /> <logger name="*" minlevel="Warn" maxlevel="Fatal" writeTo="errorFile" /> </rules></nlog>
Nlog Configuration file
Nlog配置实例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。