设为首页 加入收藏

TOP

Exceptionless(二) - 使用进阶(二)
2019-09-17 17:14:21 】 浏览:57
Tags:Exceptionless 使用 进阶
手失败。

清除Url
我们现在使用的Url都会带有#!,例如

http://localhost:50001/#!/type/error/dashboard

可以按照下面步骤清除字符#!

  • 首先保证你的IIS是否已经安装了重写模块,可通过双击IIS中的模块查看是否包含了RewriteModule
  • 更新Web.config文件
    • 释放出在system.webServer中的rewrite节点
    • 删除BaseURL值中的/#
    • 注释了在system.webServer\modules中的<remove name="RewriteModule" />标签
  • 修改app.config.77fc9ddd679d37dc.js文件中USE_HTML5_MODE的值为true

进程外运行作业
默认情况下,所有作业都在当前的Web进程中运行。如果发现事件处理开始变慢的时候,可以启动并扩展多个作业实例。通过在进程外运行作业,可以确保所有作业是否正常运行。

  • 首先是要配置安装Redis,这样可以保证Exceptionless与作业之间能够进行通信
  • 更新Web.config中的RunJobsInProcess值为false
  • 更新作业的配置,有两种方法可选:
    • 使用环境变量进行配置Exceptionless。新增环境变量Exceptionless_{SETTING NAME} (例如: Exceptionless_BaseURL, Exceptionless_ElasticSearchConnectionString)。这是官方推荐的方法,因为它更简单,而且当部署到azure时非常好用
    • 打开App_Data\jobs文件夹,然后按照在根目录中Web.config的配置,再重新配置每个作业的xxx.exe.config
  • 在每个作业文件夹中都有一个run.bat文件,双击它就会运行这个作业。当然,也可以将这些作业全部设置为Windows服务在后台运行

更多设置
除了上面提到的设置,Exceptionless还支持很多自定义配置,下面是全部的设置列表,大家可根据自己的需要进行定制
列表按照这个格式进行排列:设置项 (数据类型,默认值)

EnableSSL (bool)
BaseURL (string)
InternalProjectId (string, "54b56e480ef9605a88a13153")
WebsiteMode (WebsiteMode, "Dev")
AppScope (string, String.Empty)
TestEmailAddress (string)
AllowedOutboundAddresses (List<string>, "exceptionless.io")
RunJobsInProcess (bool, true)
BotThrottleLimit (int, 25)
ApiThrottleLimit (int, Int32.MaxValue)
EventSubmissionDisabled (bool)
MaximumEventPostSize (long, 1000000)
MaximumRetentionDays (int, 180)
EnableDailySummary (bool)
MetricsServerName (string, "127.0.0.1")
MetricsServerPort (int, 8125)
EnableMetricsReporting (bool)
RedisConnectionString (string)
EnableRedis (bool)
DisableSnapshotJobs (bool)
DisableIndexConfiguration (bool)
ElasticSearchConnectionString (string)
ElasticSearchNumberOfShards (int, 1)
ElasticSearchNumberOfReplicas (int)
EnableElasticsearchTracing (bool)
LdapConnectionString (string)
EnableActiveDirectoryAuth (bool)
EnableSignalR (bool, true)
Version (string)
EnableIntercom (bool)
IntercomAppSecret (string)
EnableAccountCreation (bool, true)
MicrosoftAppId (string)
MicrosoftAppSecret (string)
FacebookAppId (string)
FacebookAppSecret (string)
GitHubAppId (string)
GitHubAppSecret (string)
GoogleAppId (string)
GoogleAppSecret (string)
GoogleGeocodingApiKey (string)
EnableBilling (bool)
StripeApiKey (string)
StorageFolder (string)
AzureStorageConnectionString (string)
EnableAzureStorage (bool)
BulkBatchSize (int, 1000)
SmtpHost (string)
SmtpPort (int, 587)
SmtpEnableSsl (bool, true)
SmtpUser (string)
SmtpPassword (string)

更多日志类型

Exceptionless除了支持记录Exception,也可以记录LogMessage、Broken Links 、Feature Usages

LogMessage
LogMessage支持多种级别的日志信息

  • Other
  • Trace
  • Debug
  • Info
  • Warn
  • Error
  • Fatal
  • Off

用法也很简单,直接在你想要记录日志的地方直接加一句

ExceptionlessClient.Default.CreateLog("日志信息", LogLevel.Debug).AddTags("tag1", "tag2").Submit();

所以我们在应用的过程中,可以添加一个统一的接口

public interface ILogger
{
    void Debug(string message, params string[] tags);
    void Error(string message, params string[] tags);
    void Fatal(string message, params string[] tags);
    void Info(string message, params string[] tags);
    void Off(string message, params string[] tags);
    void Other(string message, p
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Asp.NetCoreWebApi入门 - 从零开.. 下一篇.NET架构师知识普及

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目