Do you want log4net to detect if there is a log4net.config file and if
so, automatically call log4net.Config.XmlConfigurator.Configure using
that file? I don't think log4net supports that. If you've already gone
through the trouble of adding a log4net reference to your project and
added logging statements throughout your code, why not add another 3
statements to your application's start-up code:
FileInfo log4netConfig= new FileInfo("log4net.config");
if (log4netConfig.Exists)
{
log4net.Config.XmlConfigurator.Configure(log4netConfig);
}
--- John Deviney <[EMAIL PROTECTED]> wrote:
> Nicko,
>
> Thanks. Your reply pulled it together. The class
> starting the application did not have a Log reference.
> I added a Log to this class and inserted the assembly
> attribute in AssemblyInfo.cs. This worked. I don't
> consider this a pure XML configuration though. Use of
> the assembly attribute is code that is checked by the
> compiler. I understand attributes are metadata but it
> is still code.
>
> One thing I found confusing in the docs is the fact
> that the assembly attribute is required to configure
> log4net without invoking the config api.
>
> John
>
> --- Nicko Cadell <[EMAIL PROTECTED]> wrote:
>
> > John,
> >
> > It looks like your app is made up of a number of
> > assemblies. One of the
> > limitations of using the configuration attributes is
> > that only the first
> > assembly to request a logger (i.e. call
> > LogManager.GetLogger) is checked
> > for assembly attributes. Looking back to your first
> > post it looks like
> > the assembly tbot-server-proxy is the first one to
> > call into log4net. Is
> > this your main assembly, the one with the attribute
> > on it? If not is it
> > possible to add a log call into your main code
> > start-up sequence before
> > other assemblies are loaded?
> >
> > Nicko