Saturday, February 04, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

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.

Subject: Using log4net with VistaDB
Prev Next
You are not authorized to post a reply.

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

10/13/2007 12:35 AM  

You're missing a connectionType node for telling log4net that it should use VistaDBConnection:

 http://logging.apache.org/log4net/release/config-examples.html

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.
Forums > Log4Net > Log4Net Mail archive > Using log4net with VistaDB



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement