Note that there are some explanatory texts on larger screens.

plurals
  1. POhaving an issue with log4net and MySQL
    primarykey
    data
    text
    <p>The plattform that I am using is Visual Basic 2012 and the Visual Studio professional 2012...</p> <p>I have a installation of log4net in my project - the version is 1.2.13, installed via the nuGet packet manager.</p> <p>By testing log4net, it seems that it is working correctly.</p> <p>But since I have installed log4net all MySQL related actions are not woking any more. I have also installed the MySQL connector via the NuGet packet manager, it is version 6.7.4</p> <p>I definitely traced down the problem to be somehow related with the installation from log4net, because when I completely remove the log4net related xml from the app.config, all MySQL actions are working again as they should work.</p> <p>log4net code from the app.config:</p> <pre><code>&lt;configSections&gt; &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/&gt; &lt;/configSections&gt; &lt;log4net&gt; &lt;root&gt; &lt;level value="ALL"/&gt; &lt;appender-ref ref="RollingLogFileAppender"/&gt; &lt;/root&gt; &lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt; &lt;file value="logfile.txt"/&gt; &lt;appendToFile value="true" /&gt; &lt;rollingStyle value="Size" /&gt; &lt;maxSizeRollBackups value="5" /&gt; &lt;maximumFileSize value="10MB" /&gt; &lt;staticLogFileName value="true" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%date %-5level %logger.%M[%thread]: %message%newline"/&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;/log4net&gt; </code></pre> <p>log4net on the top of each class:</p> <pre><code>Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType) </code></pre> <p>log4net code in the AssemblyInfo.vb:</p> <pre><code>&lt;Assembly: log4net.Config.XmlConfigurator(Watch:=True)&gt; </code></pre> <p>Example of DB QUery:</p> <pre><code>Private Sub btnMySQLScalarQuery_Click(sender As Object, e As EventArgs) Handles btnMySQLScalarQuery.Click Dim DatabaseAccessObject As New classDatabaseAccess With {.MySQLIpAdress = "10.140.140.220", .MySQLUsername = "admin", .MySQLPassword = "adminxyz", .MySQLDBName = "sensors", .ErrorMsg = True} Try Using command As New MySqlCommand Using connection As New MySqlConnection((DatabaseAccessObject.GetMySQLConnectionString())) **connection.Open()** command.Connection = connection command.CommandText = "SELECT COUNT(*) FROM wims_detections WHERE id &gt; @start AND id &lt; @end" command.Prepare() command.Parameters.AddWithValue("@start", 100) command.Parameters.AddWithValue("@end", 1000) connection.Close() End Using MessageBox.Show(DatabaseAccessObject.ScalarQuery(command)) End Using Catch ex As Exception End Try End Sub </code></pre> <p>This is the error message, that I get, when the log4net is activated due to having the code in the app.config:</p> <p><strong>The type initializer for "MySql.Data.MySqlClient.Replication.ReplicationManager" generated an exception.</strong></p> <p>I am not using the ReplicationManager...! But it seams that the ReplicationManager has somehow an issue wit log4net...</p> <p>The error happens in the line, where I am attemting to open the Database connection ... connection.open()</p> <p>I have to note here, that I am also using SQLite in my project, tough SQLite is absolutely unaffected by this issue - even tough I have buildt the MySQL Querys / NonQuerys / Transactions the same way I have buildt that with SQLite...</p> <p>Help is needed!</p> <p>Kind Regards...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload