Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: How to enable IP address logging with Log4Net configuration
Prev Next
You are not authorized to post a reply.

Author Messages
Laxmilal Menaria

12/15/2007 12:25 PM  

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

Johnson, Cedrick

12/17/2007 4:29 PM  

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

Laxmilal Menaria

12/18/2007 5:20 AM  

ok..thanks..

Laxmilal Menaria

01/14/2009 8:23 AM  


Its working at application Level but if at the same time any other user will
come to site. Then this property value is changed so logs show the latest
value. (I have set this property at session start).

So is there any other configuration to do this? because too many users will
visit the site at same time.

Please let me know.

Thanks,
Laxmilal
--
View this message in context: http://www.nabble.com/How-to-enable-IP-address-logging-with-Log4Net-configuration-tp14349967p21451120.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > How to enable IP address logging with Log4Net configuration



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement