You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?xml version="1.0" encoding="utf-8" ?>
- <!--
- 参考:http://www.cnblogs.com/fuchongjundream/p/3936431.html
- autoReload:自动再配置
- internalLogFile:可以让NLog把内部的调试和异常信息都写入指定文件里程序没问题了,日志却出了问题。这个该怎么办,到底是哪里不正确了?假如日志本身除了bug该如何解决?这就需要日志排错。把日志的错误信息写入日志。
- <nlog throwExceptions="true" />
- <nlog internalLogFile="file.txt" />- 设置internalLogFile属性可以让NLog把内部的调试和异常信息都写入指定文件里。
- <nlog internalLogLevel="Trace|Debug|Info|Warn|Error|Fatal" /> - 决定内部日志的级别,级别越高,输出的日志信息越简洁。
- <nlog internalLogToConsole="false|true" /> - 是否把内部日志输出到标准控制台。
- <nlog internalLogToConsoleError="false|true" /> - 是否把内部日志输出到标准错误控制台 (stderr)。
- 设置throwExceptions属性为“true”可以让NLog不再阻挡这类异常,而是把它们抛给调用者。在部署是这样做可以帮我们快速定位问题。一旦应用程序已经正确配置了,我们建议把throwExceptions的值设为“false”,这样由于日志引发的问题不至于导致应用程序的崩溃。
- -->
- <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- autoReload="true"
- internalLogFile="wwwroot/logs/JT808.Gateway/internalLog.txt"
- internalLogLevel="Debug" >
- <variable name="Directory" value="/data/logs/JT808.Gateway"/>
- <targets>
- <target name="Gateway" xsi:type="File"
- fileName="${Directory}/Gateway.${shortdate}.log"
- layout="${date:format=yyyyMMddHHmmss} ${callsite} ${level}:${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"/>
- <target name="console" xsi:type="ColoredConsole"
- useDefaultRowHighlightingRules="false"
- layout="${date:format=yyyyMMddHHmmss} ${callsite} ${level} ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}">
- <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>
- </targets>
- <rules>
- <logger name="*" minlevel="Trace" maxlevel="Fatal" writeTo="Gateway,console"/>
- </rules>
- </nlog>
|