Hello, I would suggest getting the latest code from the CVS repository and also grabbing the latest version of Nant, also from CVS.
Both these projects seem to be behind in updating their respective packages ... -----Original Message----- From: Patrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 3:40 AM To: [email protected] Subject: ERROR: No appender named [A] could be found I have downloaded Log4net 1.1.1 at http://prdownloads.sourceforge.net/log4net/log4net_1_1_1.zip?use_mirror= ovh I can't even get the TestApp example working (I have stripped it down and still no joy!). I note that the sample app does not have a config file in there. So here is what I did 1) Extracted zip file to c:\ 2) Add reference to c:\ c:\log4net_1_1_1\bin\log4net.dll to the Visual Studio project c:\log4net_1_1_1\example\TestApp\TestApp.csproj 3) Source file and config file at the end of this posting 4) Compiled the testapp project when I run the app, I get the following displayed on the console log4net:ERROR No appender named [A] could be found. log4net:ERROR No appender named [B] could be found. log4net:ERROR No appenders could be found for category (MainApp). log4net:ERROR Please initialize the log4net system properly. I am running Windows XP Professional SP1, .NET Framework 1.1, Visual Studio .NET 2003 Enterprise Architect. I note that if instead of adding reference to the dll distributed with the installation, I 1) Add project c:\log4net_1_1_1\src\log4net.csproj to the VS solution 2) Add project reference to log4net.csproj (instead of log4net.dll) 3) recomplie 4) As I debug, I found out that on the following line 421 of Config\DOMConfigurator.cs 4.1) a quick watch on appenderRef.OwnerDocument.GetElementsByTagName("appender").Count returns 0! 4.2) a quick watch on appenderRef.OwnerDocument.OuterXml returns "" 4.3) a quick watch on appenderRef.paretnNode.OuterXml returns "<root>\r\n<level value=\"DEBUG\" />\r\n<appender-ref ref=\"A\" />\r\n<appender-ref ref=\"B\" />\r\n</root>" Line 421: appenderRef.OwnerDocument.GetElementsByTagName(APPENDER_TAG) I don't understand why? We got the same code, this surely is just XML, why is mine not reading the XML properly?? Did you have to do anything else other other than compiling the sourcecode and app.config you posted? *******************************Start of App.Config******************************* <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <appSettings> <add key="log4net.Internal.Debug" value="true"/> </appSettings> <log4net> <root> <level value="DEBUG" /> <appender-ref ref="A" /> <appender-ref ref="B" /> </root> <appender name="B" type="log4net.Appender.FileAppender"> <param name="File" value="log-file.txt" /> <param name="AppendToFile" value="true" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> </layout> </appender> <appender name="A" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> </layout> </appender> </log4net> </configuration> *******************************End of App.Config******************************* *******************************Start of MainApp.cs******************************* class MainApp { //Initialise log to log4net.LogManager.Root makes no difference- still ERROR private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMeth od() .DeclaringType); public MainApp() { } /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { log4net.Config.DOMConfigurator.Configure(); if(log.IsInfoEnabled) { log.Info("logging start!"); } } } *******************************End of MainApp.cs******************************* This electronic message transmission, including attachments, is for the exclusive use of the individuals to which this e-mail is addressed and is to be reviewed and used exclusively for authorized company purposes. This transmission may contain proprietary, confidential or privileged information. If you are not the intended recipient of this transmission, you are hereby notified that any use, copying, disclosure, dissemination, distribution or taking of any action in reliance upon the contents of this transmission is strictly prohibited. If you believe you may have received this electronic message in error, please notify the sender immediately by return email and delete or destroy the original message and/or any copy of it from your computer system and/or your files. Thank you.
