Thanks Nicko. 

For the sake of anyone in the future who has a similar situation, turns out I 
had two problems. First of all I only had a "using" statement for my 
log4net.Extensions namepace, I was missing a "using log4net" which is needed by 
the assembly attribute. That was a dumb mistake but didn't generate any compile 
errors and DebugView didn't tell me anything since log4net wasn't loading 
properly (my debugging is turned on using the config file).

Second problem, which I discovered when the first problem was solved and 
DebugView started showing output, was that my config file was in the class 
library's folder, when it should be in the runtime folder of the application 
that uses the class library (eg., /mywebservice, if "mywebservice" is the 
application using your class library). Makes sense, I should've known that too.

Thanks,
Simon.

---------- Original Message ----------------------------------
From: "Nicko Cadell" <[EMAIL PROTECTED]>
Reply-To: "Log4NET User" <[email protected]>
Date:  Fri, 7 Jan 2005 13:51:57 -0000

>Simon, 
>
>You can put your assembly level attributes in any source file, but I
>tend to put them in the AssemblyInfo.cs as that has a number of assembly
>attributes in it.
>
>Does the application using your class library also use log4net? Or does
>it load any other libraries that do?
>
>To understand where log4net is looking for the configuration file you
>need to enable internal debug.
>http://logging.apache.org/log4net/release/manual/faq.html#internalDebug
>
>
>Nicko
>
>> -----Original Message-----
>> From: mailing [mailto:[EMAIL PROTECTED] 
>> Sent: 06 January 2005 21:43
>> To: [email protected]
>> Subject: log4net can't find config file
>> 
>> Hi,
>> 
>> I'm trying to use log4net in a class library, so there's no 
>> .config file or global.asax file. Usually I have the 
>> following assembly attribute in the global.asax.cs to 
>> instruct log4net where to find the config file (named 
>> <myassembly>.dll.log4net):
>> 
>> [assembly: 
>> log4net.Config.DOMConfigurator(ConfigFileExtension="log4net", 
>> Watch=true)]
>> 
>> Since there's no global.asax.cs, I have the above assembly 
>> attribute in one of the class files in the class library. Is 
>> this the wrong place to put it? It doesn't appear that 
>> log4net is reading the config file.
>> 
>> How do I get this to work in a class library like this?
>> 
>> Simon.
>> 
>

Reply via email to