zoukankan      html  css  js  c++  java
  • .Net Core NLog 配置

    NLog.config

    <?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"
          xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
          autoReload="true"
          throwExceptions="false"
          internalLogLevel="Off" internalLogFile="c:	emp
    log-internal.log">
    
        <variable name="logDirectory" value="${basedir}/logs"/>
        <variable name="layoutVal" value="${date:format=HH:mm:ss}|${uppercase:${level}}|${callsite:fileName=True}${newline}${message}${newline}${exception}"/>
        <variable name="consoleVal" value="${date:format=HH:mm:ss}|${pad:padding=5:inner=${level:uppercase=true}}|${message}"/>
        
        <targets>
            <target name="console" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
                    layout="${consoleVal}" >
                <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 xsi:type="File"
                name="logfile"
                fileName="${logDirectory}/${shortdate}_info.log"
                keepFileOpen="false"
                layout="${layoutVal}" />
            <target xsi:type="File"
                name="warnfile"
                fileName="${logDirectory}/${shortdate}_warn.log"
                keepFileOpen="false"
                layout="${layoutVal}" />
            <target xsi:type="File"
                name="errfile"
                fileName="${logDirectory}/${shortdate}_error.log"
                keepFileOpen="false"
                layout="${layoutVal}" />
            <target xsi:type="File"
                name="debugfile"
                fileName="${logDirectory}/${shortdate}_debug.log"
                keepFileOpen="false"
                layout="${layoutVal}" />
        </targets>
        
        <rules>
            <logger name="*" minlevel="Trace" writeTo="console"/>
            <logger name="*" minlevel="Error" writeTo="errfile" />
            <logger name="*" minlevel="Warn" writeTo="warnfile"/>
            <logger name="*" minlevel="Info" writeTo="logfile"/>
            <logger name="*" minlevel="Debug" writeTo="debugfile" />
        </rules>
    </nlog>
  • 相关阅读:
    HDU_1711 Number Sequence(KMP)
    快速排序+归并排序
    贪心算法
    HDU_1496 Equations && POJ_1840 Eqs(Hash)
    POJ_1328 Radar Installation(贪心)
    HDU_1055 && POJ_2054 Color a Tree(贪心)
    HDU_1754 I Hate It (线段树)
    哈希(Hash)表学习笔记
    jQuery插件datepicker的使用详解
    json总结
  • 原文地址:https://www.cnblogs.com/vipsoft/p/12893646.html
Copyright © 2011-2022 走看看