You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by mailing <ma...@wallis.ca> on 2005/01/06 22:43:23 UTC
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.
Re: log4net can't find config file
Posted by Ron Grabowski <ro...@yahoo.com>.
If you assembly is called Foo and your .DLL file is called Foo.dll, try
naming your file config file Foo.dll.log4net
FYI, I've found that when I am building and launching my program from
inside of Visual Studio ((i.e. pressing F5) the config file is not
found . I need build my project then launch the program from the Debug
directory where it was built. Everything may work fine for you.
- Ron
--- mailing <ma...@wallis.ca> wrote:
> 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.
>