You could set it by Application level context. I have configured
hostname logging by doing the following (I'm sure there is a method in
System.Net to find the IP address, similar to the hostname)
In your code:
log4net.GlobalContext.Properties["Hostname"] = Dns.GetHostName();
In the RollingLogFileAppender's layout/ConversionPattern section:
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %property{Hostname} [%thread]
%-5level %logger - %message%newline" />
</layout>
Hope this helps,
CJ
-----Original Message-----
From: Laxmilal Menaria [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 15, 2007 6:25 AM
To: [email protected]
Subject: How to enable IP address logging with Log4Net configuration
Hello,
I am asp.net user, and want to store IP address in Log4Net logs, I am
using RollingFileAppender, so how can I enable IP logging with
conversion pattern.
Please let me know, how its is possible ?
Thanks in advance,
Laxmilal