小编Sue*_*rsi的帖子

在 .net core 3.1 控制台应用程序中将 nlog 与 ApplicationInsightsTelemetryWorkerService 结合使用

我正在使用应用程序见解和 nlog 配置 .net core 3 控制台应用程序

我的代码配置如下

程序.cs

 .ConfigureLogging((hostingContext, logging) =>
 {
     logging.ClearProviders();
     logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
     logging.AddNLog(NLog.LogManager.LoadConfiguration("nlog.config").Configuration);
 })
 .ConfigureServices((hostContext, services) =>
 {
      services.SetupConfiguration(hostContext.Configuration);
      services.AddApplicationInsightsTelemetryWorkerService("--AI-Key--");
Run Code Online (Sandbox Code Playgroud)

在我的 nlog.config 中我有

  <extensions>
    <add assembly="NLog.Web.AspNetCore"/>
    <add assembly="Microsoft.ApplicationInsights.NLogTarget" />
  </extensions>
 <!-- the targets to write to -->
  <targets>
    <target name="Console" xsi:type="Console"  layout="${longdate} ${level} ${message}"/>
    <target xsi:type="ApplicationInsightsTarget" name="appInsights" />
  </targets>

  <!-- rules to map from logger name to target -->
  <rules>
    <!--All logs, including from Microsoft-->
    <logger name="*" minlevel="Trace" writeTo="Console" />
    <logger name="*" minlevel="Trace" writeTo="appInsights" />
  </rules>
Run Code Online (Sandbox Code Playgroud)

在 …

c# nlog azure azure-application-insights asp.net-core-3.1

7
推荐指数
1
解决办法
2142
查看次数

minio etag是如何生成的

有谁知道当你PUT一个对象时minio etag是如何生成的?它是文件的哈希值吗?我们可以用它来防止同一文件上传两次吗?

非常感谢!

etag minio

6
推荐指数
1
解决办法
6927
查看次数