Skip to content

The Elapsed property for CommandExecuted event is defined as string in the logs. #33598

Open

Description

Hi,

This is a minor issue regarding the logs that EF produces. For the CommandExecuted event, among other properties, EF adds an elapsed field. The field is added as a string, instead of int or any other numeric format (e.g. the commandTimeout is properly added as a number). It's a minor annoyance while querying the logs. The elapsed field is very useful information actually.

Here is a sample output:

{
  "Properties": {
    "elapsed": "2",
    "parameters": "@__age_0='30' (Nullable = true)",
    "commandType": "Text",
    "commandTimeout": 30,
    "newLine": "\r\n",
    "commandText": "SELECT [c].[Id], [c].[Age], [c].[Email], [c].[Name]\r\nFROM [Customers] AS [c]\r\nWHERE [c].[Age] > @__age_0",
    "EventId": {
    	"Id": 20101,
    	"Name": "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted"
    },
    "SourceContext": "Microsoft.EntityFrameworkCore.Database.Command",
    "ActionId": "4f25e37c-3bf6-4ca1-b509-eb7b09499790",
    "ActionName": "SerilogDemo.Web.TestController.TestDb (SerilogDemo.Web)",
    "RequestId": "0HN33J2941FQR:0000000B",
    "RequestPath": "/test-db",
    "ConnectionId": "0HN33J2941FQR",
  }
}

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions