No I haven't - and to be fair, I did try doing this a while ago:

<code file='global.asax' method='Application_Start'>

            log4net.Config.XmlConfigurator.Configure();

            //reset the logger to use the default con string - so we
only need to change it on one place
            var hier =
              log4net.LogManager.GetRepository() as
log4net.Repository.Hierarchy.Hierarchy;

            if (hier != null)
            {
                //get ADONetAppender
                var adoAppender =
(log4net.Appender.AdoNetAppender)hier.GetLogger("root",hier.LoggerFactory).GetAppender("AdoNetAppender");
                var adoAppender =
(log4net.Appender.AdoNetAppender)hier.Root.Appenders[0];
                if (adoAppender != null)
                {
                    adoAppender.ConnectionString =
AppSettings.GetConfigurationString("MainConnection");
                    adoAppender.ActivateOptions(); //refresh settings
of appender
                }
            }

</code>

and failed - but this is possibly because of a few things outside the
responsibility of the log4net codebase.

There's nothing wrong working through a poroblem - to help improve the
situ - but just rubbishing it won't help anyone.

w://

On Tue, Jun 16, 2009 at 10:08 AM, James Green <james.gr...@occam-dm.com> wrote:
>
> Hi Wayne,
>
> I didn't wish to start a flame war.
>
> This is not the first time I've had trouble finding decent log4net docs when 
> configuring without AppConfig, in fact Google hardly returns a thing on this 
> topic.  Surely database logging is one of the most popular features and I'm 
> highlighting what I think to be a massive gap in its documentation.
>
> I love log4net, it was a no brainer for me to pick but don't think getting 
> this library configured using pure C# is easy.  Have you completed this task 
> without using Xml config?  Xml config is not always possible nor desirable.
>
> James.
> ________________________________
> From: codingvi...@googlemail.com [mailto:codingvi...@googlemail.com] On 
> Behalf Of Wayne Douglas
> Sent: 16 June 2009 09:58
> To: Log4NET User
> Subject: Re: Using AdoNetAppender
>
> why don't you write a fluent interface for it!?!?
>
> I think that for FREE software provided with SOURCE - it's a pretty darn good 
> tool at a pretty darn good price - and so does the rest of the _whole_ 
> industry - it being an _industry_ _standard_!
>
> There are plenty of other loggers out there too - for free - open source - 
> some good some not so good - all off the backs of some very hard work by some 
> very tallented and commited people.
>
> w://
>
> On Tue, Jun 16, 2009 at 9:48 AM, James Green <james.gr...@occam-dm.com> wrote:
>>
>> Hi Again,
>>
>> Surely, this is all pointing to a far bigger problem.  That is an horrific 
>> piece of code!!  Surely this is doable in pure C#?
>>
>> I'm amazed that this AdoNetAppender is so poorly documented and has so few 
>> examples.  It's starting to put me off log4net!
>>
>> James.
>> ________________________________
>> From: Ron Grabowski [mailto:rongrabow...@yahoo.com]
>> Sent: 15 June 2009 22:32
>> To: Log4NET User
>> Subject: Re: Using AdoNetAppender
>>
>> This page shows an example of loading an xml string into an XmlDocument then 
>> configure log4net from the XmlDocument:
>>
>> http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/AdoNetAppenderTest.cs?view=co
>> ________________________________
>> From: James Green <james.gr...@occam-dm.com>
>> To: Log4NET User <log4net-user@logging.apache.org>
>> Sent: Monday, June 15, 2009 12:04:16 PM
>> Subject: RE: Using AdoNetAppender
>>
>> I think I'm going to have to try the config file method first.
>>
>> I'm wrapping log4net and I don't want to cause every consuming component to 
>> require loads of config information in it just for logging purposes.
>>
>> Everything else is a sinch to configure in code, save for this appender ... 
>> *sigh* ...
>>
>> Cheers,
>>
>> James.
>> scanned by MessageLabs [www.messagelabs.com]
>
>
>
> --
> Cheers,
>
> w://
>
> scanned by MessageLabs [www.messagelabs.com]



--
Cheers,

w://

Reply via email to