We are writing unit tests for our business layer running under .NET 4.0. The business layer is a simple C # class library that typically runs on SOAP and REST web services. Our application uses log4net in a separate assembly for registration. The C # code in the protocol assembly contains an assembly information directive that tells log4net the name of the configuration file, a la -
[build: log4net.Config.XmlConfigurator (ConfigFile = "AcmeLogging.config", Watch = true)]
Initializing log4net through the shell works fine in web services. When we initialize it using our unit test assembly, it does not appear in the configuration file. The configuratino file is configured using the properties that need to be copied to the execution directory, and we see it in the bin \ debug directory. A quick console test program using a logging node that works from the same folder works fine. It is curious that behavior problems are intermittent and appear on different machines of developers at different times and cannot be cured in any deterministic way.
When executing the wrapper assembly code, the call to log4netLogManager.GetLogger () appears correctly, but the list of add-ons returned by log.Logger.Repository.GetAppenders () is empty. Since this incorrect behavior is the same regardless of whether the file is in the Bin \ Debug folder or not, we believe that it does not see the file.
Any hints regarding what we are missing in starting log4net in the Microsoft Test Framework would be greatly appreciated.
Biff gaut
source share