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 ri...@tritanka.com on 2007/10/12 22:47:57 UTC

Custom Appender - Clients still require Log4Net reference?

I have a custom log implementation (baseless LogManager, extended ILog and extended LogImpl).
It's working fine.  The only problem is that the projects which reference my custom logger, also seem to require that I specifically add a reference to Log4Net.  Is there a way to avoid this?   In the main entry to the application, I do have a reference to log4net because I didn't go through the effort of wrapping the configuration bit.  I'm fine with that because it isn't prolific, but in non application entry related assemblies, I'd prefer to only have to reference the custom logger.

I've set the log4net reference in my custom logger project to have - copy local=true so log4net is copied to the bin directory when building my custom logger.

I have also tried building my custom logger using the Log4net source as a project reference rather than referencing the the built assembly but that doesn't seem to work either.

I have not seen this type of behavior elsewhere, where I have a reference to an assembly (custom logger)  that has a reference to another assembly (log4net).

Thank you in advance,
Rich

Re: Custom Appender - Clients still require Log4Net reference?

Posted by Peter Drier <pe...@gmail.com>.
If you extend a class, then that classes definition is part of your
definition, and thus the extended class must be available to anyone using
your class in order to compile.

If you completely wrap a class and translate all calls to and from it, then
it would not be needed by anyone referencing you..

Example:

assembly AAA.dll:

class A
{
}

Assembly BBB.dll:

class B
{
}

Assembly CCC.dll:

class C : A
{
   private B blah = new B();
}

---

Anyone using C, will need a reference to A, but not B..

-Peter

On 10/12/07, richard.collette@tritanka.com <ri...@tritanka.com>
wrote:
>
> I have a custom log implementation (baseless LogManager, extended ILog and
> extended LogImpl).
> It's working fine.  The only problem is that the projects which reference
> my custom logger, also seem to require that I specifically add a reference
> to Log4Net.  Is there a way to avoid this?   In the main entry to the
> application, I do have a reference to log4net because I didn't go through
> the effort of wrapping the configuration bit.  I'm fine with that because it
> isn't prolific, but in non application entry related assemblies, I'd prefer
> to only have to reference the custom logger.
>
> I've set the log4net reference in my custom logger project to have - copy
> local=true so log4net is copied to the bin directory when building my custom
> logger.
>
> I have also tried building my custom logger using the Log4net source as a
> project reference rather than referencing the the built assembly but that
> doesn't seem to work either.
>
> I have not seen this type of behavior elsewhere, where I have a reference
> to an assembly (custom logger)  that has a reference to another assembly
> (log4net).
>
> Thank you in advance,
> Rich
>
>
>
>
>