<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      開源日志框架Exceptionless使用教程

      Exceptionless是一款日志記錄框架,它開源、免費、提供管理界面、易于安裝和使用。ExceptionLess底層采用ElasticSearch作為日志存儲,提供了快速、豐富的查詢API,方便我們進行系統(tǒng)集成。本文將介紹ExceptionLess的常見用法。

      安裝ExceptionLess

      在ExceptionLess官網(wǎng)提供了基于Docker的私有化部署方式,我們可以按照官網(wǎng)的方式進行測試環(huán)境的安裝。

      1. 在官網(wǎng)github中下載最新的release包,地址:https://github.com/exceptionless/Exceptionless/releases
      2. 解壓縮,然后進入解壓縮的目錄,執(zhí)行 docker-compose up -d命令在后臺啟動多個容器,當執(zhí)行完成后,Exceptionless已經(jīng)在本地運行起來了。我們可以在Kitematic中查看運行中的容器
      3. 按照官網(wǎng)的說明,5000端口是登陸頁面,但實際情況是5000是API,5100才是登陸頁面,因此我們打開http://localhost:5100進入登陸頁面。注意:此處可能跟版本有關(guān),在使用時查看docker的端口映射。

      通過以上步驟,就在本地搭建好了測試環(huán)境。我們可以看到啟動的總共啟動了6個容器,分別是redis、elasticsearch、kibana、Exceptionless Job、Exceptionless Api、Excetpionless UI。

      快速上手

      搭建好測試環(huán)境后,首先訪問Exceptionless UI來創(chuàng)建用戶、組織和項目。然后,當項目創(chuàng)建完成之后,Exceptionless 會跳轉(zhuǎn)到客戶端配置頁面,來指引我們?nèi)绾问褂肊xceptionless客戶端。我們可以選擇自己需要用到的客戶端,通過頁面的指引完成客戶端配置。

      引導(dǎo)頁面如下:

      image

      按照這種方式我們可以完成.Net平臺項目、JS項目的配置。

      客戶端API:https://github.com/exceptionless/Exceptionless.Net/wiki

      配置好以后,我們就可以記錄日志了,例如(代碼來源于官網(wǎng)):

      // Import the exceptionless namespace.
      using Exceptionless;
      
      // Submit logs
      ExceptionlessClient.Default.SubmitLog("Logging made easy");
      
      // You can also specify the log source and log level.
      // We recommend specifying one of the following log levels: Trace, Debug, Info, Warn, Error
      ExceptionlessClient.Default.SubmitLog(typeof(Program).FullName, "This is so easy", "Info");
      ExceptionlessClient.Default.CreateLog(typeof(Program).FullName, "This is so easy", "Info").AddTags("Exceptionless").Submit();
      
      // Submit feature usages
      ExceptionlessClient.Default.SubmitFeatureUsage("MyFeature");
      ExceptionlessClient.Default.CreateFeatureUsage("MyFeature").AddTags("Exceptionless").Submit();
      
      // Submit a 404
      ExceptionlessClient.Default.SubmitNotFound("/somepage");
      ExceptionlessClient.Default.CreateNotFound("/somepage").AddTags("Exceptionless").Submit();
      
      // Submit a custom event type
      ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Low Fuel", Type = "racecar", Source = "Fuel System" });
      
      

      功能介紹

      Exceptionless中的事件有以下幾種類型:

      • 日志消息:記錄的日志,可以是任何文本內(nèi)容
      • 特性使用:功能使用量的記錄,例如接口調(diào)用情況等
      • 異常情況:記錄異常的信息
      • 失效鏈接:當被訪問的頁面不存在時進行記錄

      除了記錄內(nèi)容外,Exceptionless還支持對事件添加標簽、附加數(shù)據(jù)、用戶描述等操作,例如(代碼來源于官網(wǎng)):

      try {
          throw new ApplicationException("Unable to create order from quote.");
      } catch (Exception ex) {
          ex.ToExceptionless()
              // Set the reference id of the event so we can search for it later (reference:id).
              // This will automatically be populated if you call ExceptionlessClient.Default.Configuration.UseReferenceIds();
              .SetReferenceId(Guid.NewGuid().ToString("N"))
              // Add the order object but exclude the credit number property.
              .AddObject(order, "Order", excludedPropertyNames: new [] { "CreditCardNumber" }, maxDepth: 2)
              // Set the quote number.
              .SetProperty("Quote", 123)
              // Add an order tag.
              .AddTags("Order")
              // Mark critical.
              .MarkAsCritical()
              // Set the coordinates of the end user.
              .SetGeo(43.595089, -88.444602)
              // Set the user id that is in our system and provide a friendly name.
              .SetUserIdentity(user.Id, user.FullName)
              // Set the users description of the error.
              .SetUserDescription(user.EmailAddress, "I tried creating an order from my saved quote.")
              // Submit the event.
              .Submit();
      }
      

      NLog、Log4net集成

      官方支持NLog、Log4net集成的支持,只需要添加相應(yīng)的日志組件的配置文件即可。以Log4net為例:

      首先添加程序集的支持:

      Install-Package Exceptionless.Log4net
      

      然后在log4net的配置文件中進行配置(代碼來源于官網(wǎng)):

      <log4net>
      <appender name="exceptionless" type="Exceptionless.Log4net.ExceptionlessAppender,Exceptionless.Log4net">
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%-4timestamp [%thread] %-5level %logger %ndc - %message%newline"/>
        </layout>
      </appender>
      
      <root>
        <level value="DEBUG"/>
        <appender-ref ref="exceptionless"/>
      </root>
      </log4net>
      
      

      API接口

      除了豐富的客戶端功能外,Exceptionless還提供了大量API的支持,這些API可以在5000端口訪問到。地址為:http://localhost:5000/docs/index.html,截圖如下:

      image

      通過這些接口,我們可以實現(xiàn)更多自定義的操作,例如用戶授權(quán)、項目管理、日志查詢等操作。

      參考資料

      posted @ 2019-09-19 00:32  拓荒者IT  閱讀(7992)  評論(1)    收藏  舉報
      皮膚配置 參考地址:https://www.yuque.com/awescnb/user
      主站蜘蛛池模板: 午夜免费无码福利视频麻豆| 老熟妇欲乱一区二区三区| 一区二区三区四区自拍视频| 国内精品无码一区二区三区| 平遥县| 中文字幕国产精品第一页| 成年人尤物视频在线观看| 亚洲国产性夜夜综合| 漂亮人妻中文字幕丝袜| 亚洲综合一区无码精品| 奇米777四色成人影视| 狼色精品人妻在线视频| 无码精品人妻一区二区三区中 | 亚洲欧美色综合影院| 石原莉奈日韩一区二区三区 | 性xxxx视频播放免费| 国产精品毛片在线看不卡| 小伙无套内射老熟女精品| 夜色福利站WWW国产在线视频| 亚洲区综合区小说区激情区| 激情综合网激情五月激情| 国产精品流白浆无遮挡| 国产午夜福利视频合集| 久久99久久99精品免观看| 亚洲欧美在线观看一区二区| 人妻少妇偷人精品一区| 狠狠色综合久久狠狠色综合| 2021AV在线无码最新| 池州市| 亚洲av不卡电影在线网址最新| 美日韩在线视频一区二区三区| 玉溪市| 久久精品无码一区二区三区| 中文文字幕文字幕亚洲色| 播放灌醉水嫩大学生国内精品| 亚洲欧洲av一区二区久久| 亚洲一区二区三区在线观看精品中文| 亚洲中文字幕aⅴ天堂| 日韩有码中文字幕国产| 丰满熟妇乱又伦在线无码视频| 99久久精品午夜一区二区|