Thursday, March 11, 2010
 
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: Programatically specify output file.
Prev Next
You are not authorized to post a reply.

Author Messages
Bernhard Heinzel

08/05/2009 11:12 AM  
Hi,

is it possible to confige a RollingFileAppender in the configfile and specify the output file programatically?

My usecase is that I want to log in different files (e.g. agent.5.out, agent.4.out, ...) but the appender which will be used should be configured in the config file.

Any Suggentions?

Thanks.

Bernhard


See all the ways you can stay connected to friends and family
Ross Hinkley

08/05/2009 2:54 PM  
A quick google search yielded this:

http://stackoverflow.com/questions/571876/best-way-to-dynamically-set-an-appender-file-path

You can leverage the %property{} part of log4net to accomplish what you're asking.

Unfortunately, if you have multiple appenders all using that property, it will be changed for all of them as it's a global property.  If that's a limitation, let me know.

Hope this helps,
Ross
Bernhard Heinzel

08/05/2009 3:04 PM  
Thank you Ross.

Works perfectly fine.

Best Regards.
Bernhard

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Programatically specify output file.



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