have you got your answer? i am keen to know that too...
Brendan Long wrote: > > Hi, > > I am using log4net in a C# console application. The requirements > specify that I retrieve the error log file and debug log file from the > registry. Once I have done that I then need to configure my application > to log to those files (for all classes). > > How do I do this? I can't find a configuration example for programmatic > configuration, but it is mentioned in the documentation and examples as > being possible. So far I have the following code. It seems to create > the files, but nothing is ever logged to them. > > log4net.Appender.FileAppender fileAppenderTrace = new > log4net.Appender.FileAppender(); > log4net.Appender.FileAppender fileAppenderError = new > log4net.Appender.FileAppender(); > fileAppenderTrace.File = registry.getTracePath(); // Load debug log > file from registry > fileAppenderError.File = registry.getLogPath(); // Load main/error > log file from registry > log4net.Filter.LevelMatchFilter logFilter = new > log4net.Filter.LevelMatchFilter(); > logFilter.LevelToMatch = log4net.Core.Level.Info; > log4net.Filter.LevelMatchFilter traceFilter = new > log4net.Filter.LevelMatchFilter(); > traceFilter.LevelToMatch = log4net.Core.Level.All; > fileAppenderTrace.ClearFilters(); > fileAppenderTrace.AddFilter(traceFilter); > fileAppenderError.ClearFilters(); > fileAppenderError.AddFilter(logFilter); > > How can I complete the configuration? > > Thanks, > Brendan. > > This communication, including any attachments, is confidential. If you are > not the intended recipient, you should not read it - please contact me > immediately, destroy it, and do not copy or use any part of this > communication or disclose anything about it. Thank you. Please note that > this communication does not designate an information system for the > purposes of the Electronic Transactions Act 2002. > > > -- View this message in context: http://www.nabble.com/Programmatic-configuration-tf2269211.html#a6443464 Sent from the Log4net - Users mailing list archive at Nabble.com.