From e14926bf7042b3ef707b84fe5966986a7bd80a45 Mon Sep 17 00:00:00 2001 From: Arthur Vickers Date: Mon, 1 Aug 2022 18:02:21 +0100 Subject: [PATCH] Downgrade the ContextInitialized event from Information to Debug Fixes #28480. --- src/EFCore/Properties/CoreStrings.Designer.cs | 2 +- src/EFCore/Properties/CoreStrings.resx | 2 +- test/EFCore.Tests/DbContextLoggerTests.cs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/EFCore/Properties/CoreStrings.Designer.cs b/src/EFCore/Properties/CoreStrings.Designer.cs index 300c707cfb3..be918c9c6e9 100644 --- a/src/EFCore/Properties/CoreStrings.Designer.cs +++ b/src/EFCore/Properties/CoreStrings.Designer.cs @@ -3167,7 +3167,7 @@ public static EventDefinition LogContextDisposed(IDiagnosticsLogger logg static logger => new EventDefinition( logger.Options, CoreEventId.ContextInitialized, - LogLevel.Information, + LogLevel.Debug, "CoreEventId.ContextInitialized", level => LoggerMessage.Define( level, diff --git a/src/EFCore/Properties/CoreStrings.resx b/src/EFCore/Properties/CoreStrings.resx index 8567610606d..d04564b4f36 100644 --- a/src/EFCore/Properties/CoreStrings.resx +++ b/src/EFCore/Properties/CoreStrings.resx @@ -732,7 +732,7 @@ Entity Framework Core {version} initialized '{contextType}' using provider '{provider}:{providerVersion}' with options: {options} - Information CoreEventId.ContextInitialized string string string? string? string + Debug CoreEventId.ContextInitialized string string string? string? string An attempt was made to lazy-load navigation '{navigation}' on a detached entity of type '{entityType}'. Lazy loading is not supported for detached entities or entities that are loaded with 'AsNoTracking'. diff --git a/test/EFCore.Tests/DbContextLoggerTests.cs b/test/EFCore.Tests/DbContextLoggerTests.cs index d1854d4117a..c2ee7edac7d 100644 --- a/test/EFCore.Tests/DbContextLoggerTests.cs +++ b/test/EFCore.Tests/DbContextLoggerTests.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Data.Common; + namespace Microsoft.EntityFrameworkCore; public class DbContextLoggerTests @@ -402,6 +404,7 @@ private static async Task LogTest( { var options = configureLogging( new DbContextOptionsBuilder() + .ConfigureWarnings(wb => wb.Log((CoreEventId.ContextInitialized, LogLevel.Information))) .UseInMemoryDatabase("DbContextLoggerTests")) .Options;