I’m looking a way to enable IP logging with log4net in ASP.NET. I found one solution but it works at Application level. Any suggestions/practices how to log IP at session level?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In
Application_BeginRequest, doand then ensure that your
PatternLayoutcontains%X{addr}somewhere in the pattern string.Update: As Tadas has pointed out, in newer versions of log4net the equivalent is
coupled with
%P{addr}in the pattern string.