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 Bernhard Heinzel <be...@live.com> on 2008/10/23 07:55:04 UTC

Partial configuration of an AdoNetAppender in the config File

Good Morning,

Is it possible to partially configure an AdoNetAppender with an config File and later pass him in the source code the connetion string and type?

So I try to use the sample config below to to configur with XMLConfiguration and then pass the  connetion string and type but I don't get it to work?

Any Suggestions?

Thanks in advance.

Regards
Bernhard

Sample Config.
</log4net>
    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
        <bufferSize value="10" />    
        <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Username],[Host],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @username, @host, @message, @exception)" />
        <parameter>
            <parameterName value="@log_date" />
            <dbType value="DateTime" />
            <layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
        </parameter>

        <parameter>
            <parameterName value="@thread" />
            <dbType value="String" />
            <size value="255" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%thread" />
            </layout>
        </parameter>

    ...
    </appender>

    <logger name="DEBUG2">
        <level value="ALL" />
        <appender-ref ref="AdoNetAppender" />
    </logger>

</log4net>

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

RE: Partial configuration of an AdoNetAppender in the config File

Posted by Bernhard Heinzel <be...@live.com>.
Not longer needed, found a work around.

Bernhard



From: bernhard.heinzel@live.com
To: log4net-user@logging.apache.org
Subject: Partial configuration of an AdoNetAppender in the config File
Date: Thu, 23 Oct 2008 07:55:04 +0200







Good Morning,

Is it possible to partially configure an AdoNetAppender with an config File and later pass him in the source code the connetion string and type?

So I try to use the sample config below to to configur with XMLConfiguration and then pass the  connetion string and type but I don't get it to work?

Any Suggestions?

Thanks in advance.

Regards
Bernhard

Sample Config.
</log4net>
    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
        <bufferSize value="10" />    
        <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Username],[Host],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @username, @host, @message, @exception)" />
        <parameter>
            <parameterName value="@log_date" />
            <dbType value="DateTime" />
            <layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
        </parameter>

        <parameter>
            <parameterName value="@thread" />
            <dbType value="String" />
            <size value="255" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%thread" />
            </layout>
        </parameter>

    ...
    </appender>

    <logger name="DEBUG2">
        <level value="ALL" />
        <appender-ref ref="AdoNetAppender" />
    </logger>

</log4net>

Discover the new Windows Vista Learn more!

_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE