Thank you for your replies.

Yes, I had to call appender.ActivateOptions() before calling Configure() and 
additionally I had to set appender.Layout. Now it works.
Btw, don't you think the design is not intuitive enough. How should I know that 
I have to set Layout and call ActivateOptions()? I read quite much on log4net 
site, but I didn't see good examples of using dynamical setting.
Don't you think it would be better if ActivateOptions() was called 
automatically in Configure() method and Layout had a default value?
What we have now is - if you don't know all the details - logging just will not 
work without any helping messages.

  ----- Original Message ----- 
  From: Ron Grabowski 
  To: Log4NET User 
  Sent: Tuesday, October 28, 2008 1:15 AM
  Subject: Re: Help me with dinamically setting up the RollingFileAppender 
please


  You probably need to call appender.ActivateOptions() before calling 
Configure().




------------------------------------------------------------------------------
  From: Pavel Bazanov <[EMAIL PROTECTED]>
  To: [email protected]
  Sent: Monday, October 27, 2008 6:16:56 AM
  Subject: Help me with dinamically setting up the RollingFileAppender please


  Hello, 

   I have just downloaded the log4net and I can't use the RollingFileAppender. 
Check my code please:

  // ###################################################################

  var appender = new log4net.Appender.RollingFileAppender();

  appender.AppendToFile = true;

  appender.File = "log.txt";

  appender.MaxFileSize = 10000;

  appender.MaxSizeRollBackups = 10;

  appender.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Size;

  log4net.Config.BasicConfigurator.Configure(appender);

  log.Info("event occurred");

  // ###################################################################

  No errors produced, but no log file is created, it just looks like nothing 
happens.

  What am I doing wrong?

  Thank you in advance.

Reply via email to