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 ckantzer <ch...@amentra.com> on 2007/10/12 19:30:27 UTC
Using log4net with VistaDB
I am trying use log4net to write to a database. The database we are using is
VistaDB. I am able to write to a file correctly but I'm getting the
following error when i try to write to the VistaDB file:
log4net:ERROR [AdoNetAppender] Could not open database connection
[Provider=VistaDB.NET20;Data Source=C:\Documents and Settings\First Name\My
Documents\Visual Studio
2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite]
System.InvalidOperationException: The 'VistaDB.NET20' provider is not
registered on the local machine.
I am using .Net 3.0. The VistaDB product came with a .Net Provider
(VistaDB.NET20) and I can write records just fine in a test app using the
Data Source Wizard and a regular Windows DataSet. For some reason I can't
get the log4net object to recognize the VistaDB provider.
My Config file is as follows:
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="log-file.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
</layout>
</appender>
<appender name="AdoNetAppender_Access"
type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionString value="Provider=VistaDB.NET20;Data
Source=C:\Documents and Settings\First Name\My Documents\Visual Studio
2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite""/>
<commandText value="INSERT INTO Log
([Date],[Thread],[newLevel],[Logger],[Message]) VALUES (@log_date, @thread,
@log_level, @logger, @message)" />
<parameter>
lots of parameter stuff
</parameter>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="FileAppender" />
<appender-ref ref="AdoNetAppender_Access" />
</root>
</log4net>
--
View this message in context: http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13177061
Sent from the Log4net - Users mailing list archive at Nabble.com.
Re: Using log4net with VistaDB
Posted by ckantzer <ch...@amentra.com>.
There is plenty of info on how to add a connectionType for a MSSQL or Oracle,
but no help in figuring out what makes up a VistaDB connectionType. Any
idea what information needs to go in the node? Has anyone else got this
working?
Ron Grabowski wrote:
>
> You're missing a connectionType node for telling log4net that it should
> use VistaDBConnection:
>
> http://logging.apache.org/log4net/release/config-examples.html
>
> ----- Original Message ----
> From: ckantzer <ch...@amentra.com>
> To: log4net-user@logging.apache.org
> Sent: Friday, October 12, 2007 1:30:27 PM
> Subject: Using log4net with VistaDB
>
>
>
> I am trying use log4net to write to a database. The database we are
> using is
> VistaDB. I am able to write to a file correctly but I'm getting the
> following error when i try to write to the VistaDB file:
>
> log4net:ERROR [AdoNetAppender] Could not open database connection
> [Provider=VistaDB.NET20;Data Source=C:\Documents and Settings\First
> Name\My
> Documents\Visual Studio
> 2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite]
> System.InvalidOperationException: The 'VistaDB.NET20' provider is not
> registered on the local machine.
>
> I am using .Net 3.0. The VistaDB product came with a .Net Provider
> (VistaDB.NET20) and I can write records just fine in a test app using
> the
> Data Source Wizard and a regular Windows DataSet. For some reason I
> can't
> get the log4net object to recognize the VistaDB provider.
>
> My Config file is as follows:
>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>
> </configSections>
>
> <log4net>
> <appender name="FileAppender" type="log4net.Appender.FileAppender">
> <file value="log-file.txt" />
> <appendToFile value="true" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] %-5level %logger
> [%property{NDC}] - %message%newline" />
> </layout>
> </appender>
> <appender name="AdoNetAppender_Access"
> type="log4net.Appender.AdoNetAppender">
> <bufferSize value="1" />
> <connectionString value="Provider=VistaDB.NET20;Data
> Source=C:\Documents and Settings\First Name\My Documents\Visual Studio
> 2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite""/>
> <commandText value="INSERT INTO Log
> ([Date],[Thread],[newLevel],[Logger],[Message]) VALUES (@log_date,
> @thread,
> @log_level, @logger, @message)" />
> <parameter>
> lots of parameter stuff
> </parameter>
> </appender>
> <root>
> <level value="INFO" />
> <appender-ref ref="FileAppender" />
> <appender-ref ref="AdoNetAppender_Access" />
> </root>
> </log4net>
> --
> View this message in context:
> http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13177061
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13201317
Sent from the Log4net - Users mailing list archive at Nabble.com.
Re: Using log4net with VistaDB
Posted by ckantzer <ch...@amentra.com>.
That worked! Thanks so much. I tried using a connectionType earlier but
couldn't get the syntax correct, and I didn't know about the
AssemblyQualifiedName method.
Here's the final code that worked:
<connectionType value="VistaDB.Provider.VistaDBConnection,
VistaDB.NET20, Version=3.2.1.41, Culture=neutral,
PublicKeyToken=dfc935afe2125461" />
<connectionString value="Provider=VistaDB.NET20;Data
Source=C:\Hanson\Hanson.BillingRecon\data\LoggerFile.vdb3;OpenMode=NonexclusiveReadWrite"/>
Thanks again.
Ron Grabowski wrote:
>
> What is the fully qualified type name of the Vista DB type that implements
> IDbConnection? I think this is the class:
>
> VistaDB.Provider.VistaDBConnection
>
> The assembly name is probably VistaDB. If both of those assumptions are
> correct then your connectionType node would probably look something like
> this:
>
> <connectionType value="VistaDB.Provider.VistaDBConnection, VistaDB" />
>
> If my guess isn't correct this should give the correct fully typed name:
>
>
> Console.WriteLine(typeof(VistaDBConnection).AssemblyQualifiedName);
>
> Thanks,
> Ron
>
> ----- Original Message ----
> From: ckantzer <ch...@amentra.com>
> To: log4net-user@logging.apache.org
> Sent: Sunday, October 14, 2007 1:42:02 PM
> Subject: Re: Using log4net with VistaDB
>
>
>
> There is plenty of info on how to add a connectionType for a MSSQL or
> Oracle,
> but no help in figuring out what makes up a VistaDB connectionType.
> Any
> idea what information needs to go in the node? Has anyone else got
> this
> working?
>
>
> Ron Grabowski wrote:
>>
>> You're missing a connectionType node for telling log4net that it
> should
>> use VistaDBConnection:
>>
>> http://logging.apache.org/log4net/release/config-examples.html
>>
>> ----- Original Message ----
>> From: ckantzer <ch...@amentra.com>
>> To: log4net-user@logging.apache.org
>> Sent: Friday, October 12, 2007 1:30:27 PM
>> Subject: Using log4net with VistaDB
>>
>>
>>
>> I am trying use log4net to write to a database. The database we are
>> using is
>> VistaDB. I am able to write to a file correctly but I'm getting the
>> following error when i try to write to the VistaDB file:
>>
>> log4net:ERROR [AdoNetAppender] Could not open database connection
>> [Provider=VistaDB.NET20;Data Source=C:\Documents and Settings\First
>> Name\My
>> Documents\Visual Studio
>> 2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite]
>> System.InvalidOperationException: The 'VistaDB.NET20' provider is not
>> registered on the local machine.
>>
>> I am using .Net 3.0. The VistaDB product came with a .Net Provider
>> (VistaDB.NET20) and I can write records just fine in a test app using
>> the
>> Data Source Wizard and a regular Windows DataSet. For some reason I
>> can't
>> get the log4net object to recognize the VistaDB provider.
>>
>> My Config file is as follows:
>>
>> <configSections>
>> <section name="log4net"
>> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>>
>> </configSections>
>>
>> <log4net>
>> <appender name="FileAppender"
> type="log4net.Appender.FileAppender">
>> <file value="log-file.txt" />
>> <appendToFile value="true" />
>> <layout type="log4net.Layout.PatternLayout">
>> <conversionPattern value="%date [%thread] %-5level %logger
>> [%property{NDC}] - %message%newline" />
>> </layout>
>> </appender>
>> <appender name="AdoNetAppender_Access"
>> type="log4net.Appender.AdoNetAppender">
>> <bufferSize value="1" />
>> <connectionString value="Provider=VistaDB.NET20;Data
>> Source=C:\Documents and Settings\First Name\My Documents\Visual
> Studio
>> 2005\Projects\TestApp\TestDB.vdb3;OpenMode=NonexclusiveReadWrite""/>
>> <commandText value="INSERT INTO Log
>> ([Date],[Thread],[newLevel],[Logger],[Message]) VALUES (@log_date,
>> @thread,
>> @log_level, @logger, @message)" />
>> <parameter>
>> lots of parameter stuff
>> </parameter>
>> </appender>
>> <root>
>> <level value="INFO" />
>> <appender-ref ref="FileAppender" />
>> <appender-ref ref="AdoNetAppender_Access" />
>> </root>
>> </log4net>
>> --
>> View this message in context:
>>
>
> http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13177061
>> Sent from the Log4net - Users mailing list archive at Nabble.com.
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13201317
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Using-log4net-with-VistaDB-tf4614199.html#a13214209
Sent from the Log4net - Users mailing list archive at Nabble.com.