Re: log4net and all that logging

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <001201c870eb$9342c070$6401a8c0@ferrari>
If so many people don't understand me, I guess it must be me. :-)
 
Let me try again, more carefully...
 
NUnit does internal logging using log4net. When it's activated, NUnit's
internal logging can
go to console or a file. As delivered, it isn't activated.
 
NUnit /also/ captures any log4net logging from the test or system under test
and displays
it in the Log tab. That logging is completely separate from anything in the
NUnit config
and must be controlled by you, in your tests. You should put any log4net
config info in a
your test config file or a separate log4net file, just as you normally do -
NUnit has no
control over /whether/ you are logging.
 
NUnit's capture of user logs is not controlled by any external config, which
is a source
of problems. It is all done internally in code. It turns out that this can
cause performance
problems when the user app, or anything it calls, is creating a lot of log
events so we need
to have some external way to disable it. That's what will be fixed in the
next release.
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of West, Jason
(Education Cabinet)
Sent: Saturday, February 16, 2008 1:16 PM
To: [email protected]
Subject: [Nunit-users] log4net and all that logging


I discovered that the assembly attributes and config files don't work. This
is because I believe
that nunit is the running .exe/assembly. What I had to do was in my test
fixture setup was to 
manually load log4net. Like below
 
public static void SetupLogging()

{

LogManager.ResetConfiguration();

// look for the config file where the .dll exists

string configDirectory = AppDomain.CurrentDomain.BaseDirectory;

FileInfo fileInfo = new FileInfo(configDirectory + @"\log4net.config");

XmlConfigurator.Configure(fileInfo);

}

 

Then the logging behaves like your configuration says.

 

Cheers.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.