logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner" <dpsen...@gmail.com>
Subject AW: log4net not reading all of app.config file
Date Fri, 28 Jun 2013 06:03:17 GMT
I'm glad you were able to sort it out.

 

Cheers

 

Von: Howe, Peter L [mailto:phowe@paychex.com] 
Gesendet: Donnerstag, 27. Juni 2013 16:54
An: Log4NET Dev
Betreff: RE: log4net not reading all of app.config file

 

Thanks again, Dominik, you were right again.  I DID forget the assembly
directive.  Now it loads properly without an explicit call to
XMLConfigurator.

 

Peter

 

From: Dominik Psenner [mailto:dpsenner@gmail.com] 
Sent: Tuesday, June 25, 2013 2:29 AM
To: 'Log4NET Dev'
Subject: AW: log4net not reading all of app.config file

 

Good morning Peter,

 

I'm happy you were able to resolve your issue. However, I would like to dig
a bit deeper to see if there's a problem with log4net. Have you looked at
the examples section and followed the steps required for configuring log4net
from the app.config file?

 

 <http://logging.apache.org/log4net/release/manual/configuration.html>
http://logging.apache.org/log4net/release/manual/configuration.html

 

Adding the following line to your AssemblyInfo.cs should do it in your case:

 

[assembly: log4net.Config.XmlConfigurator(Watch=true)]

 

You have not forgotten to add it, have you?

 

Cheers

 

Von: Howe, Peter L [mailto:phowe@paychex.com] 
Gesendet: Montag, 24. Juni 2013 21:43
An: Log4NET Dev
Betreff: RE: log4net not reading all of app.config file

 

Thank you for the suggestions, I had already added my own WriteLine
statements but had not tried the XMLConfigurator.  I traced right down to
the calls to log4net, and the test program was making the calls, but nothing
was generated.  

 

This one line of code (along with the necessary using statements) fixed the
problem:

 

            XmlConfigurator.ConfigureAndWatch(new FileInfo("app.config"));

 

I have no idea why it was not reading the app.config file properly to begin
with, which still makes me nervous that something else is still broken (and
then repaired by the explicit call to  XMLConfigurator), but I'm not going
to look the gift horse in the mouth!  I can proceed now, while noting the
problem in the back of my mind.  Thanks again!

 

Peter

 

 

From: Dominik Psenner [mailto:dpsenner@gmail.com] 
Sent: Monday, June 24, 2013 2:48 PM
To: Log4NET Dev
Subject: Re: log4net not reading all of app.config file

 

Hi Peter,

very strange problem indeed. Have you tried loading the configuration from a
separate config file (XmlConfigurator.Configure(file))? Have you tried to
output something on the Console right nearby the log4net logging calls to
check whether your program really generates logging events
(Console.WriteLine())? Either way, you'll have to post more information. At
least we need the output of log4net internal logging. Even better would be a
sample application showing the problem.

Cheers,
D.


On 06/24/2013 04:58 PM, Howe, Peter L wrote:

I have a very strange problem.  It appears that log4net is not reading the
entire config file.  I know it is reading at least PART of the file, because
I can enable the internal key ("<add key="log4net.Internal.Debug"
value="true"/>) by changing the comment markers, and log4net outputs debug
information according to whether or not that line in the config file is
activated (by uncommenting.)  However, it does not seem to see the rest of
the config file, as nothing in the <log4net> section generates any debug
output, while in a different project the exact same app.config file
generates copious debug output for the <log4net> section.

 

Any insights will be greatly appreciated.  Thanks.

 

Peter

 

The information contained in this message may be privileged, confidential
and protected from disclosure. If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
your representative immediately and delete this message from your computer.
Thank you.


Mime
View raw message