diff --git a/src/EFCore.Design/Design/Internal/OperationLogger.cs b/src/EFCore.Design/Design/Internal/OperationLogger.cs index 683eee55c2d..aac42d95afe 100644 --- a/src/EFCore.Design/Design/Internal/OperationLogger.cs +++ b/src/EFCore.Design/Design/Internal/OperationLogger.cs @@ -65,7 +65,7 @@ public virtual void Log( { // Only show SQL when verbose if (_categoryName == DbLoggerCategory.Database.Command.Name - && eventId.Id == RelationalEventId.CommandExecuting.Id) + && eventId.Id == RelationalEventId.CommandExecuted.Id) { logLevel = LogLevel.Debug; } diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index 9128e7cdeba..d01dc2e1d4c 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Reflection; @@ -1315,7 +1315,7 @@ public static EventDefinition LogCommandCreated([NotNull] IDiagnost () => new EventDefinition( logger.Options, RelationalEventId.CommandExecuting, - LogLevel.Information, + LogLevel.Debug, "RelationalEventId.CommandExecuting", level => LoggerMessage.Define( level, @@ -1339,7 +1339,7 @@ public static EventDefinition LogCommandCreated([NotNull] IDiagnost () => new EventDefinition( logger.Options, RelationalEventId.CommandExecuted, - LogLevel.Debug, + LogLevel.Information, "RelationalEventId.CommandExecuted", level => LoggerMessage.Define( level, diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index 7df7e5b049d..8f45ee74fcf 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -310,11 +310,11 @@ Executing DbCommand [Parameters=[{parameters}], CommandType='{commandType}', CommandTimeout='{commandTimeout}']{newLine}{commandText} - Information RelationalEventId.CommandExecuting string System.Data.CommandType int string string + Debug RelationalEventId.CommandExecuting string System.Data.CommandType int string string Executed DbCommand ({elapsed}ms) [Parameters=[{parameters}], CommandType='{commandType}', CommandTimeout='{commandTimeout}']{newLine}{commandText} - Debug RelationalEventId.CommandExecuted string string System.Data.CommandType int string string + Information RelationalEventId.CommandExecuted string string System.Data.CommandType int string string Failed executing DbCommand ({elapsed}ms) [Parameters=[{parameters}], CommandType='{commandType}', CommandTimeout='{commandTimeout}']{newLine}{commandText} diff --git a/test/EFCore.Design.Tests/Design/Internal/OperationLoggerTest.cs b/test/EFCore.Design.Tests/Design/Internal/OperationLoggerTest.cs index dfaf9b661dc..c62c37693c8 100644 --- a/test/EFCore.Design.Tests/Design/Internal/OperationLoggerTest.cs +++ b/test/EFCore.Design.Tests/Design/Internal/OperationLoggerTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.EntityFrameworkCore.Design.Internal public class OperationLoggerTests { [ConditionalFact] - public void Log_dampens_logLevel_when_CommandExecuting() + public void Log_dampens_logLevel_when_CommandExecuted() { var reporter = new TestOperationReporter(); var loggerFactory = new LoggerFactory(); @@ -20,7 +20,7 @@ public void Log_dampens_logLevel_when_CommandExecuting() var logger = loggerFactory.CreateLogger(DbLoggerCategory.Database.Command.Name); logger.Log( LogLevel.Information, - RelationalEventId.CommandExecuting, + RelationalEventId.CommandExecuted, null, null, (_, __) => "-- Can't stop the SQL"); diff --git a/test/EFCore.Relational.Tests/Storage/RelationalCommandTest.cs b/test/EFCore.Relational.Tests/Storage/RelationalCommandTest.cs index b1e8d03f42f..07b18b2e2ae 100644 --- a/test/EFCore.Relational.Tests/Storage/RelationalCommandTest.cs +++ b/test/EFCore.Relational.Tests/Storage/RelationalCommandTest.cs @@ -955,8 +955,8 @@ public async Task Logs_commands_without_parameter_values( Assert.Equal(LogLevel.Debug, logFactory.Log[0].Level); Assert.Equal(LogLevel.Debug, logFactory.Log[1].Level); - Assert.Equal(LogLevel.Information, logFactory.Log[2].Level); - Assert.Equal(LogLevel.Debug, logFactory.Log[3].Level); + Assert.Equal(LogLevel.Debug, logFactory.Log[2].Level); + Assert.Equal(LogLevel.Information, logFactory.Log[3].Level); foreach (var (_, _, message, _, _) in logFactory.Log.Skip(2)) { @@ -1017,8 +1017,8 @@ public async Task Logs_commands_parameter_values( CoreResources.LogSensitiveDataLoggingEnabled(new TestLogger()).GenerateMessage(), logFactory.Log[2].Message); - Assert.Equal(LogLevel.Information, logFactory.Log[3].Level); - Assert.Equal(LogLevel.Debug, logFactory.Log[4].Level); + Assert.Equal(LogLevel.Debug, logFactory.Log[3].Level); + Assert.Equal(LogLevel.Information, logFactory.Log[4].Level); foreach (var (_, _, message, _, _) in logFactory.Log.Skip(3)) {