Capture username with log4net

后端 未结 6 1246
忘了有多久
忘了有多久 2020-11-27 17:05

I currently write all log4net events to a database, and it seems to work just fine. To capture the logged in user account I use this piece of code:

HttpConte         


        
6条回答
  •  無奈伤痛
    2020-11-27 17:53

    As of Log4Net version 1.2.11 you can now simply use the appender pattern to get the authorized user via the ASP .NET request e.g.

    %aspnet-request{AUTH_USER}
    

提交回复
热议问题