Log4Net "Could not find schema information" messages

Solution 1:

You can bind in a schema to the log4net element. There are a few floating around, most do not fully provide for the various options available. I created the following xsd to provide as much verification as possible: http://csharptest.net/downloads/schema/log4net.xsd

You can bind it into the xml easily by modifying the log4net element:

<log4net 
     xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Solution 2:

I had a different take, and needed the following syntax:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.xml", Watch = true)]

which differs from xsl's last post, but made a difference for me. Check out this blog post, it helped me out.

Solution 3:

Just a word of warning to anyone follow the advice of the answers in this thread. There is a possible security risk by having the log4net configuration in an xml off the root of the web service, as it will be accessible to anyone by default. Just be advised if your configuration contains sensitive data, you may want to put it else where.

Solution 4:

I believe you are seeing the message because Visual Studio doesn't know how to validate the log4net section of the config file. You should be able to fix this by copying the log4net XSD into C:\Program Files\Microsoft Visual Studio 8\XML\Schemas (or wherever your Visual Studio is installed). As an added bonus you should now get intellisense support for log4net