一、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下载安装,搭建完全属于自己的分布式日志。

三、安装使用效果
* 首页
59998-20180625182439975-2082464323.png
* 异常明细页
59998-20180626000248963-138409727.png

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

四、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

转载于:https://www.cnblogs.com/long88/p/9227005.html

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐