Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 75203 invoked from network); 19 Aug 2009 13:59:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Aug 2009 13:59:19 -0000 Received: (qmail 63853 invoked by uid 500); 19 Aug 2009 13:59:37 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 63787 invoked by uid 500); 19 Aug 2009 13:59:37 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 63778 invoked by uid 99); 19 Aug 2009 13:59:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2009 13:59:37 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [194.73.101.37] (HELO NEWCASTLE.pulsion.local) (194.73.101.37) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2009 13:59:25 +0000 Received: from NEWCASTLE.pulsion.local ([fe80::15e8:cf20:1160:d813]) by NEWCASTLE.pulsion.local ([fe80::15e8:cf20:1160:d813%10]) with mapi; Wed, 19 Aug 2009 14:59:04 +0100 From: Sidharth Nayyar To: Log4NET User Date: Wed, 19 Aug 2009 14:59:03 +0100 Subject: RE: No appenders found Thread-Topic: No appenders found Thread-Index: AcogxZB1qihf1xxwSia9PFQ0x74CDgADeBVw Message-ID: <7F1E127F5D578F4D9FD10C31602CE4C012915000@NEWCASTLE.pulsion.local> References: <7F1E127F5D578F4D9FD10C31602CE4C012914F7C@NEWCASTLE.pulsion.local> <006601ca20b2$51438f10$f3caad30$@com> <7F1E127F5D578F4D9FD10C31602CE4C012914F8B@NEWCASTLE.pulsion.local> In-Reply-To: Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: multipart/alternative; boundary="_000_7F1E127F5D578F4D9FD10C31602CE4C012915000NEWCASTLEpulsio_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_7F1E127F5D578F4D9FD10C31602CE4C012915000NEWCASTLEpulsio_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Ross, that's it logging now. Unfortunately it's only using the appenders as specified in the root elemen= t, even though I'm trying to access it by "MyLogger" name. So I presume MyL= ogger isn't registered with the default repository? Should I therefore crea= te a new repository with MyLogger name in order to use that Logger? Also is there some documentation that shows all the configuration elements?= I looked at the SDK but I couldn't find it. Thanks again for all your help. Regards, Sidharth From: Ross Hinkley [mailto:rosshinkley@gmail.com] Sent: 19 August 2009 13:06 To: Log4NET User Subject: Re: No appenders found Sidharth, I think it depends on the log4net section handler you're using. That overl= oad of configure has specifies that the configuration must use the Log4NetC= onfigurationSectionHandler. See: http://logging.apache.org/log4net/release/sdk/log4net.Config.XmlConfigurat= or.Configure_overload_2.html for more information. Alternatively, you could try the following in your code: log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDoma= in.SetupInformation.ConfigurationFile)); -Ross On Wed, Aug 19, 2009 at 5:11 AM, Sidharth Nayyar > wrote: Hi Wolfgang, Thanks for your quick response. I've added this to the code now: if (!_defaultLog.Logger.Repository.Configured) { log4net.Config.XmlConfigurator.Configure(_defaultLog.Logger= .Repository); } But the repository is still appearing as unconfigured and still no appender= s. I've even tried doing a default XmlConfigurator.Configure(); before GetL= ogger() call. Is that the right way of calling the Configure() method? Sidharth From: Wolfgang Trog [mailto:wolfgang@wollinet.com] Sent: 19 August 2009 10:49 To: 'Log4NET User' Subject: RE: No appenders found Do you have a XmlConfigurator.Configure(); Or one of the other possibilities to configure log4net somewhere in your co= de ? -- Wolfgang From: Sidharth Nayyar [mailto:Sidharth.Nayyar@pulsion.co.uk] Sent: Mittwoch, 19. August 2009 11:43 To: log4net-user@logging.apache.org Subject: No appenders found Hello all, I'm new to log4net, so sorry for the really basic question! I've added this to the web.config of my site:
... " /> " /> " /> And in my code I have this: private static ILog _defaultLog; ... _defaultLog =3D log4net.LogManager.GetLogger("MyLogger"); _defaultLog.Error("test"); However nothing gets written to event log, file or smtp. While debugging th= ere doesn't seem to be any appenders to the repository. So I'm presuming I = haven't set up my configuration properly. Unfortunately I can't see where I= 'm going wrong - can you see where I'm going wrong? Thanks in advance. Regards Sidharth --_000_7F1E127F5D578F4D9FD10C31602CE4C012915000NEWCASTLEpulsio_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Thanks Ross, that’s it logging now. =

 

Unfortunately it’s only using the appenders as specifi= ed in the root element, even though I’m trying to access it by “My= Logger” name. So I presume MyLogger isn’t registered with the default reposit= ory? Should I therefore create a new repository with MyLogger name in order to u= se that Logger?

 

Also is there some documentation that shows all the configuration elements? I looked at the SDK but I couldn’t find it.

 

Thanks again for all your help.

 

Regards,

Sidharth

 

 

 

From: Ross Hinkley [mailto:rosshinkley@gmail.= com]
Sent: 19 August 2009 13:06
To: Log4NET User
Subject: Re: No appenders found

 

Sidharth,

I think it depends on the log4net section handler you're using.  That overload of configure has specifies that the configuration must use the Log4NetConfigurationSectionHandler.  See:

 http://logging.apache.org/log4net/rele= ase/sdk/log4net.Config.XmlConfigurator.Configure_overload_2.html

for more information.

Alternatively, you could try the following in your code:

log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));

-Ross

On Wed, Aug 19, 2009 at 5:11 AM, Sidharth Nayyar <<= a href=3D"mailto:Sidharth.Nayyar@pulsion.co.uk">Sidharth.Nayyar@pulsion.co.uk= > wrote:

Hi Wolfgang,<= /o:p>

 <= /p>

Thanks for your quick response. 

 <= /p>

I’ve added this to = the code now:

  &= nbsp;         if (!_defaultLog.Logger.Repository.Config= ured)

  &= nbsp;         {

  &= nbsp;           &nbs= p; log4net.Config.XmlConfigurator.Configu= re(_defaultLog.Logger.Repository);

  &= nbsp;         }

 <= /p>

But the repository is sti= ll appearing as unconfigured and still no appenders. I’ve even tried doi= ng a default XmlConfigurator.Configure(); before GetLogger() call. Is that the r= ight way of calling the Configure() method?

 <= /p>

Sidharth

 <= /p>

From: Wolfgang Trog [mailto:wolfgang@wollinet.c= om]
Sent: 19 August 2009 10:49
To: 'Log4NET User'
Subject: RE: No appenders found

 

Do you have = a

 

XmlConfigurator.Configure();

 

Or one of th= e other possibilities to configure log4net somewhere in your code ?

 

--

Wolfgang

 

From: Sidharth Nayyar [mailto:Sidharth.Na= yyar@pulsion.co.uk]
Sent: Mittwoch, 19. August 2009 11:43
To: log4net-user@logging.apache.org
Subject: No appenders found

 

Hello all,

I’m new to log4net, = so sorry for the really basic question!

 

I’ve added this to t= he web.config of my site:

 

        <sectionname""type"" />

    <log4net>=

        <appendername""type""          &nb= sp; <applicationName value= ""          &nb= sp; <layout type<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blue= '>=3D""          &nb= sp;     <conversionPattern value= ""          &nb= sp; </layout>

        </appender        <appendername""type""          &nb= sp; <file value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <appendToFile value= ""          &nb= sp; <rollingStyle value= ""          &nb= sp; <datePattern value= ""          &nb= sp; <maxSizeRollBackups value= ""          &nb= sp; <maximumFileSize value= ""          &nb= sp; <layout type<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blue= '>=3D""          &nb= sp;     <conversionPattern value= ""          &nb= sp; </layout>

        </appender        <appendername""type""          &nb= sp; <to value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <from value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <subject value= "" />

          &nb= sp; <smtpHost value= ""          &nb= sp; <bufferSize value= ""          &nb= sp; <lossy value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <evaluator type<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blue= '>=3D""          &nb= sp;     <threshold value= ""          &nb= sp; </evaluator>

          &nb= sp; <layout type<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blue= '>=3D""          &nb= sp;     <conversionPattern value= ""          &nb= sp; </layout>

        </appender 

        <!-- Set root logger level to DEBUG and its only appender to A1 -->

        <root          &nb= sp; <level value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <appender-ref ref""        </root 

        <loggername""          &nb= sp; <level value=3D<= span lang=3DDE-CH style=3D'font-size:10.0pt;font-family:"Courier New";color:blac= k'>""          &nb= sp; <appender-ref ref""          &nb= sp; <appender-ref ref""          &nb= sp; <appender-ref ref""        </logger 

    </log4net>=

 

And in my code I have this= :

=         private static= ILog _defaultLog;

= …

=             _defaultLog =3D log4net.LogManager.Get= Logger("MyLogger");

=             _defaultLog.Error("test");

 

 

However nothing gets writt= en to event log, file or smtp. While debugging there doesn’t seem to be any appenders to the repository. So I’m presuming I haven’t set up = my configuration properly. Unfortunately I can’t see where I’m goi= ng wrong - can you see where I’m going wrong?

 

Thanks in advance.<= o:p>

 

Regards<= /p>

Sidharth=

 

 

--_000_7F1E127F5D578F4D9FD10C31602CE4C012915000NEWCASTLEpulsio_--