zoukankan      html  css  js  c++  java
  • NLog 配置 示例

    <?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"
         >
      <extensions>
        <add assembly="NLog.Targets.ElasticSearch"/>
      </extensions>
    
      <!-- optional, add some variabeles
      https://github.com/nlog/NLog/wiki/Configuration-file#variables
      -->
      <variable name="myvar" value="myvalue"/>
    
      <targets async="true">
        <target xsi:type="File" name="File"  fileName="${environment:variable=NLOGDIR}/****.WebApi.log"
                archiveAboveSize="20000000" archiveNumbering="Rolling"  encoding="UTF-8" enableFileDelete="true"  maxArchiveFiles="5"
                layout="[${date:format=yyyy-MM-dd HH:mm:ss}][${level}] ${logger} ${message} ${exception:format=toString} ${aspnet-request:cookie=String:serverVariable=String:queryString=String:item=String:form=String:header=String}"   />
        <target name="PerformanceLogES" xsi:type="ElasticSearch" uri="${configsetting:name=ElasticSearchServerAddress}"  index="perflog-****-webapi-${date:format=yyyy.MM.dd}" documentType="logevent" includeAllProperties="true"
                 layout="[${date:format=yyyy-MM-dd HH:mm:ss}][${level}] ${logger} ${message} ${exception:format=toString}">
              <field name="MachineName" layout="${machinename}" />
              <!--<field name="AllEventProperties" layout="${all-event-properties:format=[key]=[value]:separator=;:includeCallerInformation=true}" />-->
              <field name="Time" layout="${longdate}" />
              <field name="level" layout="${level:uppercase=true}" />
              <field name="logger" layout=" ${logger}" />
              <field name="message" layout=" ${message}" />
              <field name="exception" layout=" ${exception:format=toString}" />
              <field name="processid" layout=" ${processid}" />
              <field name="threadname" layout=" ${threadname}" />
              <field name="stacktrace" layout=" ${stacktrace}" />
              <field name="Properties" layout="${machinename} ${longdate} ${level:uppercase=true} ${logger} ${message} ${exception}|${processid}|${stacktrace}|${threadname}" />
              <field name="WWNamespace" layout="${environment:WWNamespace}" />
        </target>
      </targets>
      <rules>
        <!-- add your logging rules here -->
        <!--<logger name="*"     minlevel="Trace" writeTo="EventLog" />-->
        <logger name="PerformanceLog" minlevel="Trace" writeTo="PerformanceLogES" final="true" />
        <logger name="*"     minlevel="Trace" writeTo="File" />
        <logger name="*"    minlevel="Trace" writeTo="ElasticSearch" />
        <!--
        <logger name="*"     minlevel="Trace" writeTo="ColoredConsole" />
        <logger name="*" minlevel="Trace" writeTo="f" />
        -->
      </rules>
    
    </nlog>
    

      

  • 相关阅读:
    洛谷P5173 传球(暴力)
    uoj#402. 【CTSC2018】混合果汁(主席树+二分)
    uoj#401. 【CTSC2018】青蕈领主(分治FFT)
    uoj#400. 【CTSC2018】暴力写挂(边分治)
    uoj#399. 【CTSC2018】假面(概率期望)
    P4769 [NOI2018]冒泡排序(dp)
    洛谷P3688/uoj#291. [ZJOI2017]树状数组
    uoj#290. 【ZJOI2017】仙人掌(数数+仙人掌+树形dp)
    Git环境部署
    mysql修改密码
  • 原文地址:https://www.cnblogs.com/panpanwelcome/p/12916835.html
Copyright © 2011-2022 走看看