Thank's for the answer. It didn't solve my problem but I tried the solution proposed by si in the post "Try XmlConfigurator.Configure() if logging is not working" and that worked! I'm a little confused why I have to manually call XmlConfigurator.Configure(). Seem like a central thing that should be done "under the hood".
Regards /Anders > Hi Anders, > > > > You can try to put: > > > > [assembly: log4net.Config.XmlConfigurator(Watch=true)] > > > > Somewhere in one of your source files, for example in your program.cs file > (before the namespace specification). > > > > Best regards > > Georg > > <http://www.l4ndash.com/> http://www.l4ndash.com - Log4net Dashboard > > > > > > > > > > From: Anders Löfgren [mailto:[EMAIL PROTECTED] > Sent: 9. oktober 2007 01:10 > To: [email protected] > Subject: Newbie problem > > > > > > Im trying to configure log4net for a console application .net 2.0. I > cant > even get the simplest configuration to work. I put this configuration in > my > app.config: > > > > <configuration> > > <configSections> > > <section name="log4net" > type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> > > </configSections> > > > > <appSettings> > > <add key="log4net.Internal.Debug" value="true"/> > > </appSettings> > > > > <log4net> > > > > <appender name="ConsoleAppender" > type="log4net.Appender.ConsoleAppender" >> > > <layout type="log4net.Layout.PatternLayout"> > > <conversionPattern value="%date [%thread] %-5level %logger [%ndc] > - > %message%newline" /> > > </layout> > > </appender> > > > > <root> > > <level value="INFO"/> > > <appender-ref ref="ConsoleAppender"/> > > </root> > > > > </log4net> > > > > </configuration> > > > > And in my code I fetch the logger through > > > > private static readonly ILog log = LogManager.GetLogger(typeof(MyClass)); > > > > and the tries to log by: > > > > if (log.IsInfoEnabled) > > { > > log.Info("Log something"); > > } > > > > Nothing is logged and when I debug the code I can see that the log > instance > is not enabled on any level. > > As can be seen from above I have enabled internal logging which give me > some > output: > > > > log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral, > PublicKey > > Token=null]. Loaded from [C:\Documents and Settings\anlo\My > Documents\Visual > Stu > > dio 2005\Projects\KasConsumerWeb\TransferKasData\bin\Debug\log4net.dll]. > (.NET R > > untime [2.0.50727.832] on Microsoft Windows NT 5.1.2600 Service Pack 2) > > log4net: DefaultRepositorySelector: defaultRepositoryType > [log4net.Repository.Hi > > erarchy.Hierarchy] > > log4net: DefaultRepositorySelector: Creating repository for assembly > [KasDataSup > > port, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] > > log4net: DefaultRepositorySelector: Assembly [KasDataSupport, > Version=1.0.0.0, C > > ulture=neutral, PublicKeyToken=null] Loaded From [C:\Documents and > Settings\anlo > > \My Documents\Visual Studio > 2005\Projects\KasConsumerWeb\TransferKasData\bin\Deb > > ug\KasDataSupport.dll] > > log4net: DefaultRepositorySelector: Assembly [KasDataSupport, > Version=1.0.0.0, C > > ulture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute > specifi > > ed. > > log4net: DefaultRepositorySelector: Assembly [KasDataSupport, > Version=1.0.0.0, C > > ulture=neutral, PublicKeyToken=null] using repository > [log4net-default-repositor > > y] and repository type [log4net.Repository.Hierarchy.Hierarchy] > > log4net: DefaultRepositorySelector: Creating repository > [log4net-default-reposit > > ory] using type [log4net.Repository.Hierarchy.Hierarchy] > > Press the Enter key to exit the program. > > > > As I understand it from the output and from debugging the appender is not > created in the Repository. Am I right? And in that case why? > > > > What am I doing wrong? > > > > Regards > > > > A > >
