From fc96fc98d0f5da3e4e6d25403173e54cf28a55a8 Mon Sep 17 00:00:00 2001 From: koudenpa Date: Sun, 4 Oct 2020 07:45:06 +0900 Subject: [PATCH 1/2] =?UTF-8?q?AppService=E3=81=A8ApplicationInsights?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E3=83=AD=E3=82=B0=E3=82=92=E6=A7=8B=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RealDiceBot/Program.cs | 26 +++++++++++++++++++++++++- RealDiceBot/RealDiceBot.csproj | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/RealDiceBot/Program.cs b/RealDiceBot/Program.cs index 2f49ebb..d52a66d 100644 --- a/RealDiceBot/Program.cs +++ b/RealDiceBot/Program.cs @@ -1,10 +1,14 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // // Generated with Bot Builder V4 SDK Template for Visual Studio EchoBot v4.10.2 using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.ApplicationInsights; +using Microsoft.Extensions.Logging.AzureAppServices; namespace RealDiceBot { @@ -17,6 +21,26 @@ public static void Main(string[] args) public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureLogging((hostingContext, builder) => + { + // https://docs.microsoft.com/ja-jp/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1 + builder.AddAzureWebAppDiagnostics(); + + // https://docs.microsoft.com/ja-jp/azure/azure-monitor/app/ilogger#aspnet-core-applications + builder.AddApplicationInsights(hostingContext.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"]); + builder.AddFilter("", LogLevel.Warning); + }) + .ConfigureServices(serviceCollection => serviceCollection + .Configure(options => + { + options.FileName = "azure-diagnostics-"; + options.FileSizeLimit = 50 * 1024; + options.RetainedFileCountLimit = 5; + }) + .Configure(options => + { + options.BlobName = "log.txt"; + })) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); diff --git a/RealDiceBot/RealDiceBot.csproj b/RealDiceBot/RealDiceBot.csproj index 1a8b933..ca701c4 100644 --- a/RealDiceBot/RealDiceBot.csproj +++ b/RealDiceBot/RealDiceBot.csproj @@ -20,6 +20,7 @@ + From 4b3b698e78bdc72667402aab8915ad7a6d38873d Mon Sep 17 00:00:00 2001 From: koudenpa Date: Sun, 4 Oct 2020 07:45:46 +0900 Subject: [PATCH 2/2] BotFrameworkTwitterAdapter v0.1.6 --- RealDiceBot/RealDiceBot.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RealDiceBot/RealDiceBot.csproj b/RealDiceBot/RealDiceBot.csproj index ca701c4..5bdee24 100644 --- a/RealDiceBot/RealDiceBot.csproj +++ b/RealDiceBot/RealDiceBot.csproj @@ -15,7 +15,7 @@ - +