zoukankan      html  css  js  c++  java
  • nlog的简单使用

    1.nuget 安装 nlog

    2.根目录下(与config同级)添加 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"

    internalLogFile="C:TempNLog.Internal.txt" >

    <variable name="logLayout"
    value="Logger:${logger}${newline}Date:${longdate} Level:${uppercase:${level}}${newline}Message:${message} ${newline}${onexception:Exception:${exception:format=toString}${newline}}" />

    <targets>
    <target name="asyncFile" xsi:type="AsyncWrapper">
    <target name="log_file" xsi:type="File"
    fileName="${basedir}/Logs/${shortdate}/${shortdate}.txt"
    layout="${logLayout}"
    archiveFileName="${basedir}/archives/${shortdate}-{#####}.txt"
    archiveAboveSize="102400"
    archiveNumbering="Sequence"
    concurrentWrites="false"
    keepFileOpen="true"
    encoding="utf-8"
    openFileCacheTimeout="30"/>
    </target>
    </targets>

    <rules>
    <logger name="*" minlevel="Info" writeTo="asyncFile" />
    </rules>
    </nlog>

    3.代码中使用

  • 相关阅读:
    2. 逻辑运算
    1. 条件
    6. 可变不可变类型
    5. 基本运算符
    4. 与用户交互
    12 .命名的EIGRP和EIGRP v6
    11. EIGRP路由SIA
    Redis 快速入门 -- Redis 快速入门(2)
    Redis 快速入门 -- Redis教程(1)
    Redis 百度百科
  • 原文地址:https://www.cnblogs.com/mmclog/p/13824726.html
Copyright © 2011-2022 走看看