Exceptionless.Net 分布式日志使用

一、 远程调用

  1.注册用户
  https://be.exceptionless.io/
 

 

2.创建asp.net core web项目
3.引用 Exceptionless.AspNetCore.Signed 
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseExceptionless("API 密钥");//远程Exceptionless的项目API密钥
    }

代码调用:

  try
            {
                throw new Exception($"this is Exceptionless.Net.Demo.Controllers.HomeController,自己抛出的异常测试11");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                ex.ToExceptionless().Submit();
                throw new Exception($"this is Exceptionless.Net.Demo.Controllers.HomeController,自己抛出的异常测试22");
            }

 

 

 

 

 
posted @ 2020-09-28 16:16  cornerhzd  阅读(241)  评论(0)    收藏  举报