I don't know if it's the best way, but I use this: log4net.Repository.Hierarchy.Hierarchy h = (log4net.Repository.Hierarchy.Hierarchy) LogManager.GetRepository(); Appender app = h.Root.Appenders[0];
Note you can also AddAppenders at runtime -- very useful for writing visual log file monitors, splash screens etc... Wayne M. Bradney Application Architect, Derivatives & Structured Products Wall Street Systems 30 Broad Street, 24th Floor, New York, NY 10004 USA Tel: +1 (212) 809 7200 Fax: +1 (212) 809 7578 Visit our website at http://www.wallstreetsystems.com This transmission may be a privileged or confidential communication. If you are not the intended recipient, you are hereby notified that you have received this transmission in error; any review, dissemination, distribution or copying of this transmission is strictly prohibited. If you have received this communication in error, please notify us immediately by reply or by telephone (call us at +1-212-809-7200) and immediately delete this message and all its attachments. -----Original Message----- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 09, 2005 2:11 PM To: [email protected] Subject: Getting Appenders At Runtime How do you get the active appenders at runtime? I apologize for a basic question, but an hour of googling and manual reading have led to nada. I'm working in 1.2.0-Beta8. I'm doing a DOM configuration with a simple rolling file appender set at root, named "RollingFile". I am able to successfully log. However, I cannot figure out how to grab a reference to the appender, which would be useful for debugging. I've done this: Dim log As ILog = LogManager.GetLogger("root") Dim connectionAppender As IAppenderAttachable = log.Logger Dim app As RollingFileAppender = connectionAppender.GetAppender("RollingFile") But app always = nothing, and the connectionAppender.Appenders collection is always empty. Any clues, hints, or suggestions would greatly appreciated.
