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 MF...@FFTW.COM on 2009/07/15 22:36:27 UTC

log4net within Excel RTD/UDF

Hi,

I am using C# to write an Excel RTD (real-time data) and UDF (user defined 
function) and having trouble figuring out how I can get log4net to 
configure itself.  My understanding is that it uses the 
AppDomain.CurrentDomain.BaseDirectory to look for the configuration file. 
This is the Excel installation directory.  I however do not install my 
application into that directory and do not put any configuration there. My 
code is installed into its' own directory which can be found by using 
Assembly.GetExecutingAssembly().CodeBase within my code.  Is there an easy 
way to have log4net use a different directory when searching for the 
configuration file?

I have had success manually loading the configuration, but this forces me 
to put my loading logic into all of the potential entry points.  I can 
have multiple RTDs and UDFs defined within one assembly.  So I am looking 
for an easy way to have one place to worry about the configuration 
loading.

thanks

Michael

                                                                *******************************************************************************
This e-mail message is intended solely for the use of the addressee.
The message may contain information that is privileged and 
confidential.
Disclosure to anyone other than the intended recipient is prohibited.
If you are not the intended recipient, please do not disseminate,
distribute or copy this communication, by e-mail or otherwise. Instead,
please notify us immediately by return e-mail(including the original
message with your reply) and then delete and discard all copies of the
message. We have taken precautions to minimize the risk of  transmitting
software viruses but nevertheless advise you to carry out your own
virus checks on any attachment to this message.  We accept
no liability for any loss or damage caused by software viruses.
*******************************************************************************



Re: log4net within Excel RTD/UDF

Posted by MF...@FFTW.COM.
Brian,

Yes, that is what I meant by manually.

I have not looked at log4net code, but I wonder if the attribute can be 
enhanced to use the different base directories.

Thanks for looking.

Michael



Brian Browning <bw...@gmail.com> 
07/15/2009 05:04 PM
Please respond to
"Log4NET User" <lo...@logging.apache.org>


To
Log4NET User <lo...@logging.apache.org>
cc

Subject
Re: log4net within Excel RTD/UDF





Hi Michael,

I believe the easiest way to do that is to to call 
XmlConfigurator.Configure with the FileInfo object for your desired file.
Is that what you meant when you said you were manually loading the 
configuration? 
If so, I apologize but I think that may be the best you can do.


On Wed, Jul 15, 2009 at 3:36 PM, <MF...@fftw.com> wrote:

Hi, 

I am using C# to write an Excel RTD (real-time data) and UDF (user defined 
function) and having trouble figuring out how I can get log4net to 
configure itself.  My understanding is that it uses the 
AppDomain.CurrentDomain.BaseDirectory to look for the configuration file. 
 This is the Excel installation directory.  I however do not install my 
application into that directory and do not put any configuration there. 
 My code is installed into its' own directory which can be found by using 
Assembly.GetExecutingAssembly().CodeBase within my code.  Is there an easy 
way to have log4net use a different directory when searching for the 
configuration file? 

I have had success manually loading the configuration, but this forces me 
to put my loading logic into all of the potential entry points.  I can 
have multiple RTDs and UDFs defined within one assembly.  So I am looking 
for an easy way to have one place to worry about the configuration 
loading. 

thanks 

Michael 

*******************************************************************************
This e-mail message is intended solely for the use of the addressee.
The message may contain information that is privileged and 
confidential.
Disclosure to anyone other than the intended recipient is prohibited.
If you are not the intended recipient, please do not disseminate,
distribute or copy this communication, by e-mail or otherwise. Instead,
please notify us immediately by return e-mail(including the original
message with your reply) and then delete and discard all copies of the
message. We have taken precautions to minimize the risk of transmitting
software viruses but nevertheless advise you to carry out your own
virus checks on any attachment to this message. We accept
no liability for any loss or damage caused by software viruses.
*******************************************************************************
 


Re: log4net within Excel RTD/UDF

Posted by Brian Browning <bw...@gmail.com>.
Hi Michael,

I believe the easiest way to do that is to to call XmlConfigurator.Configure
with the FileInfo object for your desired file.
Is that what you meant when you said you were manually loading the
configuration?
If so, I apologize but I think that may be the best you can do.


On Wed, Jul 15, 2009 at 3:36 PM, <MF...@fftw.com> wrote:

>
> Hi,
>
> I am using C# to write an Excel RTD (real-time data) and UDF (user defined
> function) and having trouble figuring out how I can get log4net to configure
> itself.  My understanding is that it uses the
> AppDomain.CurrentDomain.BaseDirectory to look for the configuration file.
>  This is the Excel installation directory.  I however do not install my
> application into that directory and do not put any configuration there.  My
> code is installed into its' own directory which can be found by using
> Assembly.GetExecutingAssembly().CodeBase within my code.  Is there an easy
> way to have log4net use a different directory when searching for the
> configuration file?
>
> I have had success manually loading the configuration, but this forces me
> to put my loading logic into all of the potential entry points.  I can have
> multiple RTDs and UDFs defined within one assembly.  So I am looking for an
> easy way to have one place to worry about the configuration loading.
>
> thanks
>
> Michael
>
>
>
> *******************************************************************************
> This e-mail message is intended solely for the use of the addressee.
> The message may contain information that is privileged and
> confidential.
> Disclosure to anyone other than the intended recipient is prohibited.
> If you are not the intended recipient, please do not disseminate,
> distribute or copy this communication, by e-mail or otherwise. Instead,
> please notify us immediately by return e-mail(including the original
> message with your reply) and then delete and discard all copies of the
> message. We have taken precautions to minimize the risk of transmitting
> software viruses but nevertheless advise you to carry out your own
> virus checks on any attachment to this message. We accept
> no liability for any loss or damage caused by software viruses.
>
> *******************************************************************************
>
>
>