logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Set Appender properties at run time?
Date Wed, 28 Sep 2005 13:35:10 GMT
Jon,

If you mean that you want to change the properties on your MsmqAppender
that you have already configured then you can do something like this:

foreach(log4net.Appender.IAppender appender in
log4net.LogManager.GetRepository().GetAppenders())
{
  // Look for the appender you want to change.
  if (appender is MsmqAppender)
  {
    MsmqAppender myAppender = (MsmqAppender)appender;

    // Change value of properties
    myAppender.QueueName = "xxx";
    myAppender.ActivateOptions();
  }
} 

Cheers,
Nicko

> -----Original Message-----
> From: Jon Finley [mailto:jdf@gksys.com] 
> Sent: 16 September 2005 13:42
> To: 'Log4NET User'
> Subject: Set Appender properties at run time?
> 
> Hi all,
>  
> I have an MsmqAppender and would like to set the queueName 
> property (to which the message should be sent) at runtime.  
> Google turns up a few links that indicate that this is 
> possible (generically).  Does anyone have a code snipped that 
> does something like this that you would be willing to share 
> or point me to a link/sample?
>  
> Thanks much!
>  
> Jon
> 

Mime
View raw message