The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
ckantzer
 |
| 10/12/2007 7:30 PM |
|
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.
|
|
|
|
|
Ron Grabowski
 |
|
ckantzer
 |
| 10/14/2007 7:42 PM |
|
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
 |
| 10/15/2007 1:13 AM |
|
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
|
|
|
|
|
ckantzer
 |
| 10/15/2007 4:37 PM |
|
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.
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|