Which version of log4net are you using? If this is a new project you should start with version 1.2 beta 8.
In the <root> you have specified <appender-ref ref="LogFileAppender"/> but there is no appender with that name. There is a <appender name="FileAppender"> did you mean to specify <appender-ref ref="FileAppender"/> instead? You have 2 FileAppenders appending to the same file. This will not work as the FileAppender takes an exclusive write lock on the file. This will mean that the first appender to open the file will win, and the second appender will not be able to write out messages at all. You should use <logger> rather than <category>, however <category> is still supported and this should not be causing an error. Your <root> defines the an appender to use. This will be inherited by child loggers, i.e. the <appender-ref ref="LogFileAppender"/> will be inherited by the XMLTest.WebForm1 logger, therefore you do no need to add another appender to that logger (i.e. <appender-ref ref="XMLTestAppender"/>) especially as it would try to write to the same file. In your web application you need to initialise log4net. This can be done programmatically by calling the DOMConfigurator.Configure method from your Application_Start method, or it can be done using a DOMConfiguratorAttribute assembly level attribute. Do you have any initialisation code, if so what does it look like. How are you getting the logger in your code? i.e. how are you calling LogManager.GetLogger. You have set <add key="log4net.Internal.Debug" value="true"/> therefore log4net should be outputting internal debug info. You can use DebugView from sysinternals to view the debug data (http://www.sysinternals.com/ntw2k/freeware/debugview.shtml). Can you post the output produced? Cheers, Nicko > -----Original Message----- > From: Abhijit Salvi [mailto:[EMAIL PROTECTED] > Sent: 17 December 2004 18:58 > To: [email protected] > Subject: Log4net Configuration Settings > > Hi, > > > > I have recently started using the Log4net Tool. I > read the documentation and it has great potential for logging > errors, debugging purposes and tracing. > > > > However I have not been able to probably configure > correctly w.r.t. to my project. > > > > Here are my settings in the Web.Config. > > > > > > <configSections> > > <section name="log4net" > type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> > > </configSections> > > > > > > <log4net debug="true"> > > <appender name="FileAppender" > type="log4net.Appender.FileAppender"> > > <file > value="c:\\Inetpub\\wwwroot\\XMLTest\\XMLTest1.txt" /> > > <appendToFile value="true" /> > > <layout type="log4net.Layout.PatternLayout"> > > <conversionPattern value="%date > [%thread] %-5level %logger [%ndc] - %message%newline" /> > > </layout> > > </appender> > > <appender name="XMLTestAppender" > type="log4net.Appender.FileAppender"> > > <file > value="c:\\Inetpub\\wwwroot\\XMLTest\\XMLTest1.txt" /> > > <appendToFile value="true" /> > > <layout type="log4net.Layout.PatternLayout"> > > <conversionPattern value="%date > [%thread] %-5level %logger [%ndc] - %message%newline" /> > > </layout> > > </appender> > > <root> > > <priority value="ERROR"/> > > <appender-ref ref="LogFileAppender"/> > > </root> > > <category name="XMLTest.WebForm1"> > > <priority value="ERROR"/> > > <appender-ref ref="XMLTestAppender"/> > > </category> > > </log4net> > > > > > > <appSettings> > > <add key="log4net.Internal.Debug" value="true"/> > > </appSettings> > > > > > > It is a .NET Web Application with namespace of XMLTest. It > creates a dll XMLTest.dll. However I debugged the Log4net > code and it takes the default Assembly instead of the XMLTest > assembly. As a result the XMLTest1.txt file is not created. > > > > Could anyone please tell me what I need to do more? > > > > Thanks in advance, > > > > Regards, > > Abhi > > > >
