logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: log4net can't find config file
Date Fri, 07 Jan 2005 17:47:50 GMT
Thanks for the info. 

> 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

I would expect that to generate a compile time error.

> 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.

The file name is relative to the AppDomain.CurrentDomain.BaseDirectory
which is usually the directory for the application running. 


Nicko

> 
> Thanks,
> Simon.
> 
> ---------- Original Message ----------------------------------
> From: "Nicko Cadell" <nicko@neoworks.com>
> Reply-To: "Log4NET User" <log4net-user@logging.apache.org>
> 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#int
> ernalDebug
> >
> >
> >Nicko
> >
> >> -----Original Message-----
> >> From: mailing [mailto:mailing@wallis.ca]
> >> Sent: 06 January 2005 21:43
> >> To: log4net-user@logging.apache.org
> >> 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.
> >> 
> >
> 

Mime
View raw message