• 微服务分布式日志-ExceptionLess篇


    一、Exceptionless 简介

    Exceptionless 是一个开源的实时的日志收集框架,它可以应用在基于 ASP.NET,ASP.NET Core,Web Api,Web Forms,WPF,Console,MVC 等技术栈的应用程序中,并且提供了Rest接口可以应用在 Javascript,Node.js 中。它将日志收集变得简单易用并且不需要了解太多的相关技术细节及配置。
    在以前,我们做日志收集大多使用 Log4net,Nlog 等框架,在应用程序变得复杂并且集群的时候,可能传统的方式已经不是很好的适用了,因为收集各个日志并且分析他们将变得麻烦而且浪费时间。
    现在Exceptionless团队给我们提供了一个更好的框架来做这件事情,我认为这是非常伟大并且有意义的,感谢他们。
    就让我们一起来看看吧。

    官网:http://exceptionless.com/

    GitHub:https://github.com/exceptionless/Exceptionless

    二、ExceptionLess使用方式

      *  可在https://be.exceptionless.io直接申请试用,试用版有限制,每天最多3000条错误日志,如需更多使只能购买付费。
    
     *  ExceptionLess开源的分布式日志框架,可通过github下载安装,搭建完全属于自己的分布式日志。
    

    三、安装使用效果
    * 首页

    * 异常明细页

    还有更多,如快速搜索、错误邮件通知等功能就在此列举......
    

    四、App.config 文件配置

    
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections>
        <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
        <section name="exceptionless" type="Exceptionless.ExceptionlessSection, Exceptionless" />
      </configSections>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
      </startup>
      <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <extensions>
              <add assembly="Exceptionless.NLog" />
        </extensions>
          <targets async="true">
          <!--默认连接官网exceptionLess start -->
          <!--<target xsi:type="Exceptionless" name="exceptionless" apiKey="h8C1yN1CfmvHH6wxzNW4JxBEc78N4BfBvJI1mayz">
                          <field name="host" layout="${machinename}" />
                          <field name="identity" layout="${identity}" />
                          <field name="windows-identity" layout="${windows-identity:userName=True:domain=False}" />
                          <field name="process" layout="${processname}" />
            </target>-->
          <!--默认连接官网exceptionLess end -->
            
          <!--本地服务器 start -->
          <target xsi:type="Exceptionless" name="exceptionless" apiKey="7BvRwz9RohyG1Bz98TFxKdJX75ZzOCHLQNLwmpqT" serverUrl="http://XX.XX.XX.XX:50000/">
            <field name="host" layout="${machinename}" />
            <field name="identity" layout="${identity}" />
                   <field name="windows-identity" layout="${windows-identity:userName=True:domain=False}" />
                   <field name="process" layout="${processname}" />
          </target>
          <!--本地服务器 end -->
    
          <!--正常写日志-->
          <target name="console" type="ColoredConsole" encoding="utf-8" layout="${longdate}|${level:uppercase=true}|${logger}|${message}" useDefaultRowHighlightingRules="true"/>
          <target name="file" type="File" encoding="utf-8" fileName="${basedir}/logs/Trade-${shortdate}.log" layout="${longdate}|${level:uppercase=true}|${logger}|${message}" />
        </targets>
          <rules>
          <!--exceptionless start 日志-->
          <logger name="*" minlevel="Trace" writeTo="exceptionless" />
          <logger name="*" minlevel="Info" writeTo="exceptionless" />
          <!--exceptionless end 日志-->
            
          <!--正常输出 start -->
          <logger name="*" minlevel="Debug" writeTo="console" />
          <logger name="*" minlevel="Warn" writeTo="file" />
          <!--正常输出 end -->
        </rules>
      </nlog>
    </configuration>
    
    

    五、源代码地址:
    * 链接: https://pan.baidu.com/s/15rEzv-gwwa0znVscPQ2mlg 密码: ecm6

  • 相关阅读:
    setCapture 适用范围
    移动web页面自动探测电话号码
    WEB页面JS实现一键拨号的电话拨打功能
    highcharts动态删除标示区
    【你不知道的JavaScript
    【你不知道的JavaScript
    【JavaScipt高级程序设计 第4版】第5章笔记 日期格式
    【JavaScipt高级程序设计 第4版】第6章笔记 Map Set
    【JavaScipt高级程序设计 第4版】第6章笔记 Array 集合引用类型
    【JavaScipt高级程序设计 第4版】第4章笔记
  • 原文地址:https://www.cnblogs.com/long88/p/9227005.html
Copyright © 2020-2023  润新知