Skip to content

Document EnableSensitiveDataLogging #673

Closed

Description

@divega

From @Wain123 on June 22, 2017 11:7

I have an ILogger with the following function:

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) {
  Console.WriteLine(formatter(state, exception));
}

DbCommands get logged and the CommandText looks correct, but all the parameter values are simply '?'. Here's a sample output from the Logger:

Executed DbCommand (78ms) [Parameters=[p0='?', p1='?' (Size = 1), p2='?', p3='?' (Size = 6), p4='?', p5='?' (Size = 1), p6='?', p7='?', p8='?' (Size = 6)], CommandType='Text', CommandTimeout='0']
INSERT INTO FRM_LAYOUT_FILTER (SEQNR, BEZEICHNUNG, CREATETIME, CREATEUSER, DEFAULT_FILTER, FORM_NAME, MODIFY_NR, MODIFYTIME, MODIFYUSER)
VALUES (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8)

Copied from original issue: dotnet/efcore#8933

Activity

  1. self-assigned this
    on Apr 10, 2018
  2. divega commented on Apr 10, 2018

    @divega
    ContributorAuthor

    From @smitpatel on June 22, 2017 14:21

    By default EF doesn't put data in logs as the data may contain sensitive information. To get those parameter values, you need to chain EnableSensitiveDataLogging() after your UseSqlServer (or equivalent method)
    e.g.
    builder.UseSqlServer("connectionstring").EnableSensitiveDataLogging()

  3. divega commented on Apr 10, 2018

    @divega
    ContributorAuthor
  4. divega commented on Apr 10, 2018

    @divega
    ContributorAuthor

    From @smitpatel on August 23, 2017 21:26

    @divega For doc issue

  5. divega commented on Apr 10, 2018

    @divega
    ContributorAuthor

    From @ajcvickers on April 10, 2018 18:57

    @divega Can this be moved out of the 2.1 milestone. (We are trying to make 2.1 only include issues that we must fix for 2.1)

  6. changed the title [-]Logging DbCommands: All parameters are '?'[/-] [+]Document EnabkeSensitiveDataLogging[/+] on Apr 11, 2018
  7. changed the title [-]Document EnabkeSensitiveDataLogging[/-] [+]Document EnableSensitiveDataLogging[/+] on Apr 11, 2018
  8. added this to the 2.1.0 milestone on Apr 24, 2018
  9. modified the milestones: 2.1.0, 2.2.0 on Jul 10, 2018
  10. added
    help wanted
    and removed on Jul 31, 2018
  11. 16 remaining items

  12. added this to the Backlog milestone on Sep 6, 2019
  13. modified the milestones: Backlog, 5.0.0 on Jan 15, 2020
  14. added 4 commits that reference this issue on Oct 17, 2020
    fcd6ed5
    ecf0d01
    4b194ad
    777e0c0
  15. added a commit that references this issue on Nov 9, 2020
    07365ee
  16. added a commit that references this issue on Nov 10, 2020
    18482b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions