logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olson, Erik J CTR NETWARCOM" <erik.j.ol...@navy.mil>
Subject ADONetAdapter for SQL Server not working
Date Thu, 03 Jun 2004 20:20:03 GMT
I'm not able to get ADONetAppender to work with SQL Server 2000.  The connection string is
good as I can copy/paste into console and web apps and connect to the SQL Server.  I debugged
into the log4net source and found that ADONetAppender's InitializeDatabaseConnection method
is never invoked, so when the code reaches line 343 of ADONetAppender.cs (SendBuffer method)
the connection is null and the Appender never gets written to.

Am I doing something wrong, or is this ADONetAppender not working correctly (RollingFileAppender
works perfectly)?  Here's my config.  I have both .NET 1.0 and 1.1 installed and am running
log4net-1.2.0-beta8.  Thanks, Erik


<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/>
  </configSections>

<log4net>
		<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
			<file value="logs/log.txt" />
			<appendToFile value="true" />
			<rollingStyle value="Size" />
			<maxSizeRollBackups value="10" />
			<maximumFileSize value="100KB" />
			<staticLogFileName value="true" />
			<layout type="log4net.Layout.PatternLayout">
				<conversionPattern value="%d [%-5p] %c - %m%n" />
			</layout>
		</appender>
	<appender name="ADONetAppender_SqlServer" type="log4net.Appender.ADONetAppender" >
              <param name="ConnectionType" value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <param name="ConnectionString" value="REMOVED FOR POSTING" />
              <param name="CommandText" value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message])
VALUES (@log_date, @thread, @log_level, @logger, @message)" />
              <param name="Parameter">
                <param name="ParameterName" value="@log_date" />
                <param name="DbType" value="DateTime" />
                <param name="Layout" type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%d{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}"
/>
                </param>
              </param>
              <param name="Parameter">
                <param name="ParameterName" value="@thread" />
                <param name="DbType" value="String" />
                <param name="Size" value="255" />
                <param name="Layout" type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%t" />
                </param>
              </param>
              <param name="Parameter">
                <param name="ParameterName" value="@log_level" />
                <param name="DbType" value="String" />
                <param name="Size" value="50" />
                <param name="Layout" type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%p" />
                </param>
              </param>
              <param name="Parameter">
                <param name="ParameterName" value="@logger" />
                <param name="DbType" value="String" />
                <param name="Size" value="255" />
                <param name="Layout" type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%c" />
                </param>
              </param>
              <param name="Parameter">
                <param name="ParameterName" value="@message" />
                <param name="DbType" value="String" />
                <param name="Size" value="4000" />
                <param name="Layout" type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%m" />
                </param>
              </param>
            </appender>
		<root>
			<level value="FATAL" />
			<appender-ref ref="RollingFileAppender" />
			<appender-ref ref="ADONetAppender_SqlServer" />
		</root>
	</log4net>



Mime
View raw message