Can you pull the connectionString for a log4net AdoNetAppender from elsewhere in a web.config file?

Posted by mrsharps on Stack Overflow See other posts from Stack Overflow or by mrsharps
Published on 2010-03-14T06:08:40Z Indexed on 2010/03/14 6:15 UTC
Read the original article Hit count: 186

Filed under:
|

Hey all. This is my first StackOverflow question.

I'm already have a db connection string in my web.config file. I scanned the log4net docs, but can't seem to find a way to use it within the log4net section of my web.config file. Is is possible to do something like this?

<connectionStrings>
    <add name="connStr" connectionString="Data Source=localhost; ..." />
</connectionStrings>

<log4net>
    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <connectionString connectionStringName="connStr"/>
      ...
</log4net>

Thanks!

© Stack Overflow or respective owner

Related posts about log4net

Related posts about web.config