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>
  • 相关阅读:
    mysql常用方法案例
    springboot整合mybatis
    mysql自定义函数统计订单状态:GET_ORDER_STATUS()
    mysql计算时间差-本例为计算分钟差然后/60计算小时保留一位小数,由于直接得小时只会取整
    mysql字段值为null时排序问题
    对象与内存(一)
    java基础提升(关于数组)
    项目的部署
    myeclipse中ssm的搭建
    ui自动化笔记 selenium_webdriver,ui自动化框架(web)
  • 原文地址:https://www.cnblogs.com/vipsoft/p/12893646.html
Copyright © 2011-2022 走看看